Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: JRuby-OpenSSL 0.7, JRuby 1.6.7
    • Fix Version/s: JRuby 1.7.0.pre1
    • Labels:
      None
    • Environment:
    • Number of attachments :
      2

      Description

      $ rvm use system
      $ ruby --version
      ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
      
      $ ruby server.rb &
      [1] 5924
      Listening on port 8043
      
      $ time curl -m 3 -k https://localhost:8043
      "GET / HTTP/1.1\r\n"
      curl: (28) Operation timed out after 3001 milliseconds with 0 bytes received
      
      real	0m3.011s
      user	0m0.008s
      sys	0m0.012s
      
      $ time ruby client.rb
      "POST /foo HTTP/1.1\r\n"
      /usr/lib/ruby/1.8/timeout.rb:64:in `rbuf_fill': execution expired (Timeout::Error)
      	from /usr/lib/ruby/1.8/net/protocol.rb:134:in `rbuf_fill'
      	from /usr/lib/ruby/1.8/net/protocol.rb:116:in `readuntil'
      	from /usr/lib/ruby/1.8/net/protocol.rb:126:in `readline'
      	from /usr/lib/ruby/1.8/net/http.rb:2028:in `read_status_line'
      	from /usr/lib/ruby/1.8/net/http.rb:2017:in `read_new'
      	from /usr/lib/ruby/1.8/net/http.rb:1051:in `request'
      	from client.rb:38
      	from /usr/lib/ruby/1.8/net/http.rb:543:in `start'
      	from client.rb:38
      	from /usr/lib/ruby/1.8/timeout.rb:67:in `timeout'
      	from /usr/lib/ruby/1.8/timeout.rb:101:in `timeout'
      	from client.rb:37
      
      real	0m2.075s
      user	0m0.056s
      sys	0m0.012s
      
      $ rvm use jruby
      $ ruby --version
      jruby 1.6.7 (ruby-1.8.7-p357) (2012-02-22 3e82bc8) (OpenJDK 64-Bit Server VM 1.6.0_23) [linux-amd64-java]
      $ gem list
      *** LOCAL GEMS ***
      bouncy-castle-java (1.5.0146.1)
      bundler (1.0.22)
      jruby-openssl (0.7.6.1)
      rake (0.8.7)
      
      $ time ruby client.rb
      "POST /foo HTTP/1.1\r\n"
      ^C
      real	0m24.111s
      user	0m5.460s
      sys	0m0.140s
      
      1. client.rb
        1 kB
        zaadjis
      2. server.rb
        3 kB
        zaadjis

        Activity

        Hide
        Charles Oliver Nutter added a comment -

        I have fixed this on master@db95241 by using the interrupt-capable RubyThread.select method rather than doing the selection logic directly in SSLSocket. I'm sure this can be improved further, but it's working for now and better than what we had before.

        Nahi: Have a look at this and let me know if I missed anything. We may want to backport this into jruby-ossl (and we need to figure out the right way to keep them in sync, too).

        Show
        Charles Oliver Nutter added a comment - I have fixed this on master@db95241 by using the interrupt-capable RubyThread.select method rather than doing the selection logic directly in SSLSocket. I'm sure this can be improved further, but it's working for now and better than what we had before. Nahi: Have a look at this and let me know if I missed anything. We may want to backport this into jruby-ossl (and we need to figure out the right way to keep them in sync, too).
        Hide
        Xavier Shay added a comment -

        I can still reproduce this bug on JRuby master as of today, on both Java 1.6 and 1.7.

        > time ruby jruby_ssl_test.rb
        ^Cruby jruby_ssl_test.rb  1.67s user 0.12s system 22% cpu 8.035 total
        > cat jruby_ssl_test.rb 
        require 'net/https'
        
        # open another terminal and run `nc -l 1234`
        client = Net::HTTP.new('localhost', 1234)
        client.use_ssl = true
        client.read_timeout = 1
        client.open_timeout = 1
        
        client.get("/")
        > ruby -v
        jruby 1.7.0.preview1 (ruby-1.9.3-p203) (2012-05-26 7554093) (Java HotSpot(TM) Client VM 1.6.0_32) [darwin-i386-java]
        > uname -a
        Darwin koopa.local 11.4.0 Darwin Kernel Version 11.4.0: Mon Apr  9 19:32:15 PDT 2012; root:xnu-1699.26.8~1/RELEASE_X86_64 x86_64
        
        Show
        Xavier Shay added a comment - I can still reproduce this bug on JRuby master as of today, on both Java 1.6 and 1.7. > time ruby jruby_ssl_test.rb ^Cruby jruby_ssl_test.rb 1.67s user 0.12s system 22% cpu 8.035 total > cat jruby_ssl_test.rb require 'net/https' # open another terminal and run `nc -l 1234` client = Net::HTTP.new('localhost', 1234) client.use_ssl = true client.read_timeout = 1 client.open_timeout = 1 client.get("/") > ruby -v jruby 1.7.0.preview1 (ruby-1.9.3-p203) (2012-05-26 7554093) (Java HotSpot(TM) Client VM 1.6.0_32) [darwin-i386-java] > uname -a Darwin koopa.local 11.4.0 Darwin Kernel Version 11.4.0: Mon Apr 9 19:32:15 PDT 2012; root:xnu-1699.26.8~1/RELEASE_X86_64 x86_64
        Hide
        Emil Ong added a comment -

        Will this be backported to JRuby 1.6? Or has anyone found a workaround?

        Show
        Emil Ong added a comment - Will this be backported to JRuby 1.6? Or has anyone found a workaround?
        Hide
        Charles Oliver Nutter added a comment -

        Xavier: I could not reproduce it... running it locally for me does time out properly:

        $ jruby ssl_test.rb 
        Timeout::Error: execution expired
        

        This could be due to fixes for 1.7.1. We'll leave this resolved.

        Emil: I have rolled the OpenSSL changes back into the jruby-openssl gem and released previews of 0.8.0. Perhaps you could test that with JRuby 1.6 (gem install --pre jruby-openssl) and let me know if it looks better for you?

        Show
        Charles Oliver Nutter added a comment - Xavier: I could not reproduce it... running it locally for me does time out properly: $ jruby ssl_test.rb Timeout::Error: execution expired This could be due to fixes for 1.7.1. We'll leave this resolved. Emil: I have rolled the OpenSSL changes back into the jruby-openssl gem and released previews of 0.8.0. Perhaps you could test that with JRuby 1.6 (gem install --pre jruby-openssl) and let me know if it looks better for you?
        Hide
        Ivasyk Telesyk added a comment -

        Still having this problem on my system.

        jruby -v
        jruby 1.7.0 (1.9.3p203) 2012-10-22 ff1ebbe on OpenJDK 64-Bit Server VM 1.7.0_06-b24 [FreeBSD-amd64]
        uname -a
        FreeBSD Pym.local 8.3-STABLE FreeBSD 8.3-STABLE #3: Mon Oct 15 14:43:10 EEST 2012 root@Pym.local:/usr/obj/usr/src/sys/SUGOI amd64

        And script posted by Xavier Shay hugs for me.

        Show
        Ivasyk Telesyk added a comment - Still having this problem on my system. jruby -v jruby 1.7.0 (1.9.3p203) 2012-10-22 ff1ebbe on OpenJDK 64-Bit Server VM 1.7.0_06-b24 [FreeBSD-amd64] uname -a FreeBSD Pym.local 8.3-STABLE FreeBSD 8.3-STABLE #3: Mon Oct 15 14:43:10 EEST 2012 root@Pym.local:/usr/obj/usr/src/sys/SUGOI amd64 And script posted by Xavier Shay hugs for me.

          People

          • Assignee:
            Hiroshi Nakamura
            Reporter:
            zaadjis
          • Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: