Connection reset by peer - Always the same but just for me

I’m having issues with the API. I always get a ‘Connection reset by peer’. For everyone else I asked to test my code it’s working. What went wrong? I’m very sure we tested always the same code.

https://gist.github.com/green-big-frog/df545c1858d410a29625

The funny thing is that I can access the API via browser.

Thanks for helping me in advance…
Buffalowave

Can you access it with CURL? What about standard ruby?

  • (standard)Ruby doesn’t work
  • Curl does

With ruby I get the same error: Connection reset by peer

If you’re able to access it via browser and curl you aren’t banned. Likely your ruby installation is messed up somehow. What version of ruby?

ruby -v
jruby 1.7.19 (1.9.3p551) 2015-01-29 20786bd on OpenJDK 64-Bit Server VM 1.7.0_79-b14 +jit [linux-amd64]

Ohh… This isn’t issue related but jruby set itself as up as ruby…

I would postulate that your jruby install doesn’t know about SSL certificates and doesn’t have a SSL cert to check against locally.

How to fix that for jruby is beyond me.

I updated the gist with versions of rvm and so on

Since it’s just me having the issue it’s probably something with my setup…

If you require 'net/https' instead of require 'net/http', does it work?

No… Exactly the same error…

Could you use something like Wireshark to intercept the packets and compare the cURL one against the Ruby one. The stack trace isn’t really giving you enough information here.

Gonna try that tomorow…

So here the Link to the wireshark capture: https://www.cloudshark.org/captures/83c5fef6318f

Maybe someone can read/* that stuff… I can’t find anything what would help us/me getting further…

@EhsanKia Did you look at the capture? Do you see something that might help?

Does this also contain the browser/cURL request? Also, what happens if you replace https with http in the jruby script? Do you get the “Requests must be made over SSL” error or do you still get Connection Reset.

I first did the curl, then a ping to heise (to see the change better) and then the jruby…

If I try to access the API via jruby with out SSL I get the error message… {"error"=>"Bad Request", "status"=>400, "message"=>"Requests must be made over SSL"}

The issue is clearly with the SSL, you can see the full handshake on top which is missing from the jruby one. And it’s confirmed by that second test. Unfortunately I don’t know enough about jruby or SSL handshake to help you with this, but that gives you specific keywords to google and hopefully fix your installation.

Updating jruby to the version 1.7.22 also didn’t help…

$jruby -v jruby 1.7.22 (1.9.3p551) 2015-08-20 c28f492 on OpenJDK 64-Bit Server VM 1.7.0_79-b14 +jit [linux-amd64]

If I had to guess, this is because your jruby is not negotiating SSL using high enough encryption. Make sure that jruby is connecting with TLS1.2, which should fix this issue.

Ok… So this is a jruby issue!

With version jruby 9.0.0.0 it works… I’m gonna have to open an issue at jruby.

Thanks for everyones help!!!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.