{"action":"created","issue":{"url":"https://api.github.com/repos/celluloid/reel/issues/153","labels_url":"https://api.github.com/repos/celluloid/reel/issues/153/labels{/name}","comments_url":"https://api.github.com/repos/celluloid/reel/issues/153/comments","events_url":"https://api.github.com/repos/celluloid/reel/issues/153/events","html_url":"https://github.com/celluloid/reel/issues/153","id":36071471,"number":153,"title":"Reel::Server::HTTPS crashes on \"Errno::ECONNRESET: Connection reset by peer - SSL_accept\"","user":{"login":"mig1984","id":7932987,"avatar_url":"https://avatars.githubusercontent.com/u/7932987?v=3","gravatar_id":"","url":"https://api.github.com/users/mig1984","html_url":"https://github.com/mig1984","followers_url":"https://api.github.com/users/mig1984/followers","following_url":"https://api.github.com/users/mig1984/following{/other_user}","gists_url":"https://api.github.com/users/mig1984/gists{/gist_id}","starred_url":"https://api.github.com/users/mig1984/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mig1984/subscriptions","organizations_url":"https://api.github.com/users/mig1984/orgs","repos_url":"https://api.github.com/users/mig1984/repos","events_url":"https://api.github.com/users/mig1984/events{/privacy}","received_events_url":"https://api.github.com/users/mig1984/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/celluloid/reel/milestones/1","html_url":"https://github.com/celluloid/reel/milestones/0.6.0","labels_url":"https://api.github.com/repos/celluloid/reel/milestones/1/labels","id":947275,"number":1,"title":"0.6.0","description":"","creator":{"login":"digitalextremist","id":21095,"avatar_url":"https://avatars.githubusercontent.com/u/21095?v=3","gravatar_id":"","url":"https://api.github.com/users/digitalextremist","html_url":"https://github.com/digitalextremist","followers_url":"https://api.github.com/users/digitalextremist/followers","following_url":"https://api.github.com/users/digitalextremist/following{/other_user}","gists_url":"https://api.github.com/users/digitalextremist/gists{/gist_id}","starred_url":"https://api.github.com/users/digitalextremist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digitalextremist/subscriptions","organizations_url":"https://api.github.com/users/digitalextremist/orgs","repos_url":"https://api.github.com/users/digitalextremist/repos","events_url":"https://api.github.com/users/digitalextremist/events{/privacy}","received_events_url":"https://api.github.com/users/digitalextremist/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":1,"state":"open","created_at":"2015-01-22T18:38:25Z","updated_at":"2015-03-22T15:20:59Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2014-06-19T11:51:30Z","updated_at":"2015-03-22T16:33:42Z","closed_at":null,"body":"Hello, \r\n\r\nwhen I send lots of requests, a reel https server experiences ECONNRESET (even with increased backlog). The bad thing is, it crashes on further issues and restarts.\r\n\r\nThe program:\r\n```ruby\r\nrequire 'reel'\r\n\r\nclass Webserver < Reel::Server::HTTPS\r\n\r\n   def initialize()\r\n      options = {:cert=>File.read('server.crt'),\r\n                 :key=>File.read('server.key')}\r\n      super('127.0.0.1', 1111, options, &method(:on_connection))\r\n   end\r\n\r\n   def on_connection(connection)\r\n      while request = connection.request\r\n         request.respond :ok, 'foobar'\r\n      end\r\n   end\r\n\r\nend\r\n\r\nWebserver.supervise_as :reel\r\n\r\nsleep\r\n```\r\n\r\n```\r\nab -v 1 -k -c 150 -n 1000 https://127.0.0.1:1111/\r\nThis is ApacheBench, Version 2.3 <$Revision: 655654 $>\r\nCopyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\r\nLicensed to The Apache Software Foundation, http://www.apache.org/\r\n\r\nBenchmarking 127.0.0.1 (be patient)\r\nCompleted 100 requests\r\nCompleted 200 requests\r\nCompleted 300 requests\r\nCompleted 400 requests\r\nCompleted 500 requests\r\nCompleted 600 requests\r\nSSL handshake failed (5).\r\nSSL handshake failed (5).\r\nCompleted 700 requests\r\nCompleted 800 requests\r\nCompleted 900 requests\r\nCompleted 1000 requests\r\nFinished 1000 requests\r\n\r\n\r\nServer Software:\r\nServer Hostname:        127.0.0.1\r\nServer Port:            1111\r\nSSL/TLS Protocol:       TLSv1.2,DHE-RSA-AES256-GCM-SHA384,1024,256\r\n\r\nDocument Path:          /\r\nDocument Length:        6 bytes\r\n\r\nConcurrency Level:      150\r\nTime taken for tests:   8.896 seconds\r\nComplete requests:      1000\r\nFailed requests:        2\r\n   (Connect: 0, Receive: 0, Length: 2, Exceptions: 0)\r\nWrite errors:           0\r\nKeep-Alive requests:    0\r\nTotal transferred:      63102 bytes\r\nHTML transferred:       5988 bytes\r\nRequests per second:    112.41 [#/sec] (mean)\r\nTime per request:       1334.387 [ms] (mean)\r\nTime per request:       8.896 [ms] (mean, across all concurrent requests)\r\nTransfer rate:          6.93 [Kbytes/sec] received\r\n```\r\n\r\n```\r\nE, [2014-06-19T13:44:11.435580 #18542] ERROR -- : Webserver crashed!\r\nErrno::ECONNRESET: Connection reset by peer - SSL_accept\r\n        /usr/local/lib64/ruby/gems/1.9.1/gems/celluloid-io-0.15.0/lib/celluloid/io/ssl_socket.rb:26:in 'accept_nonblock'\r\n        /usr/local/lib64/ruby/gems/1.9.1/gems/celluloid-io-0.15.0/lib/celluloid/io/ssl_socket.rb:26:in 'accept'\r\n        /usr/local/lib64/ruby/gems/1.9.1/gems/celluloid-io-0.15.0/lib/celluloid/io/ssl_server.rb:26:in 'accept'\r\n        /usr/local/lib64/ruby/gems/1.9.1/gems/reel-0.5.0/lib/reel/server/https.rb:52:in 'block in run'\r\n        /usr/local/lib64/ruby/gems/1.9.1/gems/reel-0.5.0/lib/reel/server/https.rb:50:in 'loop'\r\n        /usr/local/lib64/ruby/gems/1.9.1/gems/reel-0.5.0/lib/reel/server/https.rb:50:in 'run'\r\n        /usr/local/lib64/ruby/gems/1.9.1/gems/celluloid-0.15.2/lib/celluloid/calls.rb:25:in 'public_send'\r\n        /usr/local/lib64/ruby/gems/1.9.1/gems/celluloid-0.15.2/lib/celluloid/calls.rb:25:in 'dispatch'\r\n        /usr/local/lib64/ruby/gems/1.9.1/gems/celluloid-0.15.2/lib/celluloid/calls.rb:122:in 'dispatch'\r\n        /usr/local/lib64/ruby/gems/1.9.1/gems/celluloid-0.15.2/lib/celluloid/actor.rb:322:in 'block in handle_message'\r\n        /usr/local/lib64/ruby/gems/1.9.1/gems/celluloid-0.15.2/lib/celluloid/actor.rb:416:in 'block in task'\r\n        /usr/local/lib64/ruby/gems/1.9.1/gems/celluloid-0.15.2/lib/celluloid/tasks.rb:55:in 'block in initialize'\r\n        /usr/local/lib64/ruby/gems/1.9.1/gems/celluloid-0.15.2/lib/celluloid/tasks/task_fiber.rb:13:in 'block in create'\r\nW, [2014-06-19T13:44:11.436462 #18542]  WARN -- : Terminating task: type=:call, meta={:method_name=>:handle_connection}, status=:iowait\r\nW, [2014-06-19T13:44:11.437076 #18542]  WARN -- : Terminating task: type=:call, meta={:method_name=>:handle_connection}, status=:iowait\r\nW, [2014-06-19T13:44:11.437354 #18542]  WARN -- : Terminating task: type=:call, meta={:method_name=>:handle_connection}, status=:iowait\r\nW, [2014-06-19T13:44:11.437619 #18542]  WARN -- : Terminating task: type=:call, meta={:method_name=>:handle_connection}, status=:iowait\r\nW, [2014-06-19T13:44:11.437933 #18542]  WARN -- : Terminating task: type=:call, meta={:method_name=>:handle_connection}, status=:iowait\r\nW, [2014-06-19T13:44:11.438190 #18542]  WARN -- : Terminating task: type=:call, meta={:method_name=>:handle_connection}, status=:iowait\r\nW, [2014-06-19T13:44:20.797228 #18542]  WARN -- : Error accepting SSLSocket: OpenSSL::SSL::SSLError: SSL_accept SYSCALL returned=5 errno=0 state=SSLv3 read client certificate A\r\nW, [2014-06-19T13:44:20.800541 #18542]  WARN -- : Error accepting SSLSocket: OpenSSL::SSL::SSLError: SSL_accept SYSCALL returned=5 errno=0 state=SSLv3 read client certificate A\r\nW, [2014-06-19T13:44:20.802708 #18542]  WARN -- : Error accepting SSLSocket: OpenSSL::SSL::SSLError: SSL_accept SYSCALL returned=5 errno=0 state=SSLv3 read client certificate A\r\nW, [2014-06-19T13:44:20.804832 #18542]  WARN -- : Error accepting SSLSocket: OpenSSL::SSL::SSLError: SSL_accept SYSCALL returned=5 errno=0 state=SSLv3 read client certificate A\r\nW, [2014-06-19T13:44:39.536508 #18542]  WARN -- : Error accepting SSLSocket: OpenSSL::SSL::SSLError: SSL_accept SYSCALL returned=5 errno=0 state=SSLv3 read client certificate A\r\nE, [2014-06-19T13:44:39.537254 #18542] ERROR -- : Webserver crashed!\r\nReel::StateError: already processing a request\r\n        /usr/local/lib64/ruby/gems/1.9.1/gems/reel-0.5.0/lib/reel/connection.rb:55:in 'request'\r\n        r.rb:12:in 'on_connection'\r\n        /usr/local/lib64/ruby/gems/1.9.1/gems/reel-0.5.0/lib/reel/server.rb:56:in 'call'\r\n        /usr/local/lib64/ruby/gems/1.9.1/gems/reel-0.5.0/lib/reel/server.rb:56:in 'handle_connection'\r\n        /usr/local/lib64/ruby/gems/1.9.1/gems/celluloid-0.15.2/lib/celluloid/calls.rb:25:in 'public_send'\r\n        /usr/local/lib64/ruby/gems/1.9.1/gems/celluloid-0.15.2/lib/celluloid/calls.rb:25:in 'dispatch'\r\n        /usr/local/lib64/ruby/gems/1.9.1/gems/celluloid-0.15.2/lib/celluloid/calls.rb:122:in 'dispatch'\r\n        /usr/local/lib64/ruby/gems/1.9.1/gems/celluloid-0.15.2/lib/celluloid/actor.rb:322:in 'block in handle_message'\r\n        /usr/local/lib64/ruby/gems/1.9.1/gems/celluloid-0.15.2/lib/celluloid/actor.rb:416:in 'block in task'\r\n        /usr/local/lib64/ruby/gems/1.9.1/gems/celluloid-0.15.2/lib/celluloid/tasks.rb:55:in 'block in initialize'\r\n        /usr/local/lib64/ruby/gems/1.9.1/gems/celluloid-0.15.2/lib/celluloid/tasks/task_fiber.rb:13:in 'block in create'\r\nW, [2014-06-19T13:44:39.537809 #18542]  WARN -- : Terminating task: type=:call, meta={:method_name=>:run}, status=:iowait\r\nW, [2014-06-19T13:44:39.537937 #18542]  WARN -- : Terminating task: type=:call, meta={:method_name=>:handle_connection}, status=:iowait\r\nW, [2014-06-19T13:44:39.538066 #18542]  WARN -- : Terminating task: type=:call, meta={:method_name=>:handle_connection}, status=:iowait\r\nW, [2014-06-19T13:44:39.538398 #18542]  WARN -- : Terminating task: type=:call, meta={:method_name=>:handle_connection}, status=:iowait\r\nW, [2014-06-19T13:44:39.538875 #18542]  WARN -- : Terminating task: type=:call, meta={:method_name=>:handle_connection}, status=:iowait\r\nW, [2014-06-19T13:44:39.539079 #18542]  WARN -- : Terminating task: type=:call, meta={:method_name=>:handle_connection}, status=:iowait\r\nW, [2014-06-19T13:44:39.539401 #18542]  WARN -- : Terminating task: type=:call, meta={:method_name=>:handle_connection}, status=:iowait\r\n```\r\n\r\n```\r\nmy environment:\r\n\r\nruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]\r\n\r\ngems:\r\n\r\ncelluloid-0.15.2\r\ncelluloid-io-0.15.0\r\nhttp-0.6.1\r\nhttp_parser.rb-0.6.0\r\nnio4r-1.0.0\r\nreel-0.5.0\r\ntimers-1.1.0\r\nwebsocket_parser-0.1.6\r\n```"},"comment":{"url":"https://api.github.com/repos/celluloid/reel/issues/comments/84649515","html_url":"https://github.com/celluloid/reel/issues/153#issuecomment-84649515","issue_url":"https://api.github.com/repos/celluloid/reel/issues/153","id":84649515,"user":{"login":"digitalextremist","id":21095,"avatar_url":"https://avatars.githubusercontent.com/u/21095?v=3","gravatar_id":"","url":"https://api.github.com/users/digitalextremist","html_url":"https://github.com/digitalextremist","followers_url":"https://api.github.com/users/digitalextremist/followers","following_url":"https://api.github.com/users/digitalextremist/following{/other_user}","gists_url":"https://api.github.com/users/digitalextremist/gists{/gist_id}","starred_url":"https://api.github.com/users/digitalextremist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digitalextremist/subscriptions","organizations_url":"https://api.github.com/users/digitalextremist/orgs","repos_url":"https://api.github.com/users/digitalextremist/repos","events_url":"https://api.github.com/users/digitalextremist/events{/privacy}","received_events_url":"https://api.github.com/users/digitalextremist/received_events","type":"User","site_admin":false},"created_at":"2015-03-22T16:33:42Z","updated_at":"2015-03-22T16:33:42Z","body":"This is pretty old, but I was able to replicate the issue with a slightly different error now.\r\n\r\nSee failure: https://gist.github.com/digitalextremist/bfa56ed40900fd23d65c\r\n\r\nOut of curiosity, I changed the request handler to this:\r\n\r\n```\r\n      connection.each_request do |request|\r\n         request.respond :ok, 'foobar'\r\n      end\r\n```\r\n\r\nSame error.\r\n\r\nThen I noticed #139 and changed from Rubinius to jRuby, and I started getting this:\r\n\r\nhttps://gist.github.com/digitalextremist/c40dba6c814dbaea3c8b"}}