Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errno::ECONNRESET: Connection reset by peer #3286

Closed
headius opened this issue Aug 26, 2015 · 3 comments
Closed

Errno::ECONNRESET: Connection reset by peer #3286

headius opened this issue Aug 26, 2015 · 3 comments

Comments

@headius
Copy link
Member

headius commented Aug 26, 2015

Transplanted from jruby/jruby-openssl#64 by @green-big-frog.

OpenSSL always fails whit specific versions! Or the handshake misses...

Steps to reproduce:

More details can be found here because I tought it might be an API issue: https://discuss.dev.twitch.tv/t/connection-reset-by-peer-always-the-same-but-just-for-me

bbelleville pushed a commit to bbelleville/jruby that referenced this issue Aug 26, 2015
bbelleville pushed a commit to bbelleville/jruby that referenced this issue Aug 26, 2015
* jruby-1_7: (27 commits)
  meh,  use the included hook instead to get a simple test skip on --1.8 mode
  some more --1.8 skip fixes (4 less future surprises)
  test skip 1.8.7 test-unit compatibility
  adding a skip-ed test-case for callin abstract (Ruby impl) method in constructor
  less intermediate strings on proxy class name generation
  some notes on Java proxy invocation handler class hierarchy + un-used import
  make generated Java proxy class fields final
  include_package spec no longer pending
  [ji] include package should work with a package instance (just like import)
  java_alias should not fail when no include_package called previously
  add a possible TODO note for proc-to-iface dispatch
  Fix VERSION so jruby-jars builds find the right jars.
  Update joda time to 2.8.2.
  Fixes jruby#3286. Encoding of symbol literals does not respect the encoding of the source file (1.9 edition)
  Move psych to 1.9 lib so only 1.9 and 2.0 modes can see it.
  backport jruby#3271, jruby#3211, jruby#3221
  [ji] improved more-specific type matching when matching Java methods
  another (pending) Java 8 JI spec - hitting the wall with Predicate#test(arg1)
  Exclude odd DateTime roundtrip failure in Psych.
  Update psych+tests to 2.0.15.
  ...

Conflicts:
	.travis.yml
	VERSION
	core/pom.xml
	core/src/main/java/org/jruby/ext/bigdecimal/RubyBigDecimal.java
	core/src/main/java/org/jruby/ext/psych/PsychLibrary.java
	core/src/main/java/org/jruby/ext/psych/PsychParser.java
	core/src/main/java/org/jruby/ext/psych/PsychToRuby.java
	core/src/main/java/org/jruby/parser/ParserSupport.java
	core/src/main/java/org/jruby/parser/Ruby19Parser.java
	core/src/main/java/org/jruby/parser/Ruby19Parser.y
	docs/man/pom.xml
	docs/pom.xml
	ext/pom.xml
	ext/readline/pom.xml
	ext/ripper/pom.xml
	lib/pom.rb
	lib/pom.xml
	lib/ruby/1.8/bigdecimal/math.rb
	lib/ruby/1.9/bigdecimal/math.rb
	lib/ruby/1.9/psych.rb
	lib/ruby/1.9/psych/coder.rb
	lib/ruby/1.9/psych/core_ext.rb
	lib/ruby/1.9/psych/deprecated.rb
	lib/ruby/1.9/psych/handler.rb
	lib/ruby/1.9/psych/handlers/document_stream.rb
	lib/ruby/1.9/psych/handlers/recorder.rb
	lib/ruby/1.9/psych/json/ruby_events.rb
	lib/ruby/1.9/psych/json/stream.rb
	lib/ruby/1.9/psych/json/tree_builder.rb
	lib/ruby/1.9/psych/json/yaml_events.rb
	lib/ruby/1.9/psych/nodes.rb
	lib/ruby/1.9/psych/nodes/alias.rb
	lib/ruby/1.9/psych/nodes/document.rb
	lib/ruby/1.9/psych/nodes/mapping.rb
	lib/ruby/1.9/psych/nodes/node.rb
	lib/ruby/1.9/psych/nodes/scalar.rb
	lib/ruby/1.9/psych/nodes/sequence.rb
	lib/ruby/1.9/psych/nodes/stream.rb
	lib/ruby/1.9/psych/omap.rb
	lib/ruby/1.9/psych/parser.rb
	lib/ruby/1.9/psych/scalar_scanner.rb
	lib/ruby/1.9/psych/set.rb
	lib/ruby/1.9/psych/stream.rb
	lib/ruby/1.9/psych/syntax_error.rb
	lib/ruby/1.9/psych/tree_builder.rb
	lib/ruby/1.9/psych/visitors.rb
	lib/ruby/1.9/psych/visitors/depth_first.rb
	lib/ruby/1.9/psych/visitors/emitter.rb
	lib/ruby/1.9/psych/visitors/json_tree.rb
	lib/ruby/1.9/psych/visitors/to_ruby.rb
	lib/ruby/1.9/psych/visitors/visitor.rb
	lib/ruby/1.9/psych/visitors/yaml_tree.rb
	lib/ruby/1.9/psych/y.rb
	lib/ruby/2.0/bigdecimal/math.rb
	maven/jruby-complete/pom.xml
	maven/jruby-dist/pom.xml
	maven/jruby-jars/pom.xml
	maven/jruby-noasm/pom.xml
	maven/jruby-rake-plugin/pom.xml
	maven/jruby-stdlib/pom.xml
	maven/jruby/pom.xml
	maven/pom.xml
	pom.xml
	spec/java_integration/packages/access_spec.rb
	test/externals/ruby1.9/psych/helper.rb
	test/externals/ruby1.9/psych/test_alias_and_anchor.rb
	test/externals/ruby1.9/psych/test_array.rb
	test/externals/ruby1.9/psych/test_boolean.rb
	test/externals/ruby1.9/psych/test_class.rb
	test/externals/ruby1.9/psych/test_coder.rb
	test/externals/ruby1.9/psych/test_date_time.rb
	test/externals/ruby1.9/psych/test_deprecated.rb
	test/externals/ruby1.9/psych/test_document.rb
	test/externals/ruby1.9/psych/test_emitter.rb
	test/externals/ruby1.9/psych/test_encoding.rb
	test/externals/ruby1.9/psych/test_exception.rb
	test/externals/ruby1.9/psych/test_hash.rb
	test/externals/ruby1.9/psych/test_json_tree.rb
	test/externals/ruby1.9/psych/test_merge_keys.rb
	test/externals/ruby1.9/psych/test_nil.rb
	test/externals/ruby1.9/psych/test_null.rb
	test/externals/ruby1.9/psych/test_numeric.rb
	test/externals/ruby1.9/psych/test_object.rb
	test/externals/ruby1.9/psych/test_object_references.rb
	test/externals/ruby1.9/psych/test_omap.rb
	test/externals/ruby1.9/psych/test_parser.rb
	test/externals/ruby1.9/psych/test_psych.rb
	test/externals/ruby1.9/psych/test_scalar.rb
	test/externals/ruby1.9/psych/test_scalar_scanner.rb
	test/externals/ruby1.9/psych/test_serialize_subclasses.rb
	test/externals/ruby1.9/psych/test_set.rb
	test/externals/ruby1.9/psych/test_stream.rb
	test/externals/ruby1.9/psych/test_string.rb
	test/externals/ruby1.9/psych/test_struct.rb
	test/externals/ruby1.9/psych/test_symbol.rb
	test/externals/ruby1.9/psych/test_tainted.rb
	test/externals/ruby1.9/psych/test_to_yaml_properties.rb
	test/externals/ruby1.9/psych/test_tree_builder.rb
	test/externals/ruby1.9/psych/test_yaml.rb
	test/externals/ruby1.9/psych/test_yamldbm.rb
	test/externals/ruby1.9/psych/test_yamlstore.rb
	test/externals/ruby1.9/psych/visitors/test_to_ruby.rb
	test/externals/ruby1.9/psych/visitors/test_yaml_tree.rb
	test/pom.xml
	test/test_command_line_switches.rb
	test/test_helper.rb
	test/test_higher_javasupport.rb
	test/test_load_gem_extensions.rb
	test/test_zlib.rb
@headius
Copy link
Member Author

headius commented Sep 3, 2015

Note from original issue: This works in 9k, which is why we transplanted it from jruby-openssl's issue tracker. I can reproduce it on OS X.

It is also unrelated to json; the error arises from within net/http:

[] ~/projects/jruby-1.7 $ jruby -rnet/http -e 'Net::HTTP.get(URI.parse("https://api.twitch.tv/kraken/streams/kingkongor"))'
Errno::ECONNRESET: Connection reset by peer - Connection reset by peer
      read_nonblock at org/jruby/RubyIO.java:2860
          rbuf_fill at /Users/headius/projects/jruby-1.7/lib/ruby/1.9/net/protocol.rb:141
          readuntil at /Users/headius/projects/jruby-1.7/lib/ruby/1.9/net/protocol.rb:122
           readline at /Users/headius/projects/jruby-1.7/lib/ruby/1.9/net/protocol.rb:132
   read_status_line at /Users/headius/projects/jruby-1.7/lib/ruby/1.9/net/http.rb:2571
           read_new at /Users/headius/projects/jruby-1.7/lib/ruby/1.9/net/http.rb:2560
  transport_request at /Users/headius/projects/jruby-1.7/lib/ruby/1.9/net/http.rb:1328
              catch at org/jruby/RubyKernel.java:1242
  transport_request at /Users/headius/projects/jruby-1.7/lib/ruby/1.9/net/http.rb:1325
            request at /Users/headius/projects/jruby-1.7/lib/ruby/1.9/net/http.rb:1302
        request_get at /Users/headius/projects/jruby-1.7/lib/ruby/1.9/net/http.rb:1204
       get_response at /Users/headius/projects/jruby-1.7/lib/ruby/1.9/net/http.rb:455
              start at /Users/headius/projects/jruby-1.7/lib/ruby/1.9/net/http.rb:746
       get_response at /Users/headius/projects/jruby-1.7/lib/ruby/1.9/net/http.rb:454
                get at /Users/headius/projects/jruby-1.7/lib/ruby/1.9/net/http.rb:431
             (root) at -e:1

@headius
Copy link
Member Author

headius commented Sep 3, 2015

Ah-ha!

I suppose I should have tested this earlier, but MRI 1.9.3 also exhibits this problem:

$ rvm ruby-1.9.3 do ruby -rnet/http -e 'Net::HTTP.get(URI.parse("https://api.twitch.tv/kraken/streams/kingkongor"))'
/Users/headius/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/protocol.rb:141:in `read_nonblock': Connection reset by peer (Errno::ECONNRESET)
    from /Users/headius/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/protocol.rb:141:in `rbuf_fill'
    from /Users/headius/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil'
    from /Users/headius/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/protocol.rb:132:in `readline'
    from /Users/headius/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/http.rb:2563:in `read_status_line'
    from /Users/headius/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/http.rb:2552:in `read_new'
    from /Users/headius/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/http.rb:1320:in `block in transport_request'
    from /Users/headius/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/http.rb:1317:in `catch'
    from /Users/headius/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/http.rb:1317:in `transport_request'
    from /Users/headius/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/http.rb:1294:in `request'
    from /Users/headius/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/http.rb:1196:in `request_get'
    from /Users/headius/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/http.rb:455:in `block in get_response'
    from /Users/headius/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/http.rb:746:in `start'
    from /Users/headius/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/http.rb:454:in `get_response'
    from /Users/headius/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/http.rb:431:in `get'
    from -e:1:in `<main>'

Ruby 2.0 and higher dealt with this by adding buffering and nonblocking read logic to the openssl library. Running JRuby with the --2.0 flag (not recommended in production) allows your script to work properly.

So unfortunately, we can't fix this for you on the 1.7 line, because it would be a behavioral divergence from MRI.

@greenbigfrog
Copy link

I'm totally fine with using of JRuby 9.0

I just ran in to this issue...

At first it just took me some time to find the origin of the issue.

Thanks for helping me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants