Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: JRuby 1.6.7
    • Fix Version/s: None
    • Labels:
    • Number of attachments :
      1

      Description

      IO.select seems to hang (and timeout) when it should not (works on MRI):

      $ ruby --version
      ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
      
      $ ruby google_ssl_test.rb
      opening connection to encrypted.google.com...
      ..snip..
      #<Net::HTTPOK 200 OK readbody=true>
      
      $ 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]
      
      $ ruby google_ssl_test.rb
      opening connection to encrypted.google.com...
      ..snip..
      Timeout::Error: execution expired (IO.select == nil)
           rbuf_fill at google_ssl_test.rb:12
                read at .rvm/rubies/jruby-1.6.7/lib/ruby/1.8/net/protocol.rb:86
        read_chunked at .rvm/rubies/jruby-1.6.7/lib/ruby/1.8/net/http.rb:2238
         read_body_0 at .rvm/rubies/jruby-1.6.7/lib/ruby/1.8/net/http.rb:2213
           read_body at .rvm/rubies/jruby-1.6.7/lib/ruby/1.8/net/http.rb:2179
                body at .rvm/rubies/jruby-1.6.7/lib/ruby/1.8/net/http.rb:2204
        reading_body at .rvm/rubies/jruby-1.6.7/lib/ruby/1.8/net/http.rb:2143
             request at .rvm/rubies/jruby-1.6.7/lib/ruby/1.8/net/http.rb:1053
            __file__ at google_ssl_test.rb:24
               start at .rvm/rubies/jruby-1.6.7/lib/ruby/1.8/net/http.rb:543
              (root) at google_ssl_test.rb:24
      

      Note that the attached google_ssl_test.rb contains a patch to net/http for JRUBY-6511.

        Activity

        Hide
        zaadjis added a comment - - edited

        No idea what is going on here, but this "fixes" the issue (makes google_ssl_test.rb run on jruby too):

        -    if IO.select [@io], nil, nil, @read_timeout
        +    if IO.select [@io], [@io], nil, @read_timeout
        

        Perhaps it's related to http://www.openssl.org/support/faq.html#PROG10 ?

        Edit: {{ IO.select [@io], [@io] }} sometimes raises HTTPBadResponse (with net/http), so this doesn't work as a work-around for JRUBY-6511.

        Show
        zaadjis added a comment - - edited No idea what is going on here, but this "fixes" the issue (makes google_ssl_test.rb run on jruby too): - if IO.select [@io], nil, nil, @read_timeout + if IO.select [@io], [@io], nil, @read_timeout Perhaps it's related to http://www.openssl.org/support/faq.html#PROG10 ? Edit: {{ IO.select [@io] , [@io] }} sometimes raises HTTPBadResponse (with net/http), so this doesn't work as a work-around for JRUBY-6511 .
        Hide
        zaadjis added a comment -

        Reproducable with jruby master:

        $ ruby --version
        jruby 1.7.0.dev (ruby-1.8.7-p357) (2012-03-15 860f429) (OpenJDK 64-Bit Server VM 1.7.0_147-icedtea) [linux-amd64-java]
        
        $ ruby google_ssl_test.rb
        opening connection to encrypted.google.com...
        ..snip..
        -> "=!vyotO9-rkdSNh-QZgw/d=1/\";F.ms=\"https://apis.google.com\";F.m=\"\";F.l=[];q.push([\"gl\",{url:\"//ssl.gstatic.com/gb/js/abc/glm_2572388ad06f10d8fe6ef9a09f798c5d.js\"}]);var ka={\"export\":C};p.gl=ka;C&&m(\"load\",E,ia);var la=/^m;/.test(F.h)&&!/\\/gapi\\/|ms=gapi/.test(F.h)?D:E;m(\"dgl\",la);m(\"agl\",ja)};var H=function(){},I=function(){},qa=function(a){var b=new Image,c=ma;b.onerror=b.onload=b.onabort=function(){try{delete na[c]}catch(a){}};na[c]=b;b.src=a;ma=c+1},na=[],ma=0;m(\"logger\",{il:I,ml:H});var J=window.gbar.logger;var ta=l.b(\"0.01\",1.0E-4),ua=0;\nfunction _mlToken(a,b){try{if(1>ua){ua++;var c,d=a,g=b||{},f=encodeURIComponent,h=[\"//www.google.com/gen_204?atyp=i&zx=\",(new Date).getTime(),\"&jexpid=\",f(\"30316\"),\"&srcpg=\",f(\"prop=1\"),\"&jsr=\",Math.round(1/ta),\"&ogf=\",j.bv.f,\"&ogv=\",f(\"1331585407.1331740271\"),\"&ogd=\",f(\"com\"),\"&ogl=\",f(\"en\")];g._sn&&(g._sn=\"og.\"+g._sn);for(var n in g)h.push(\"&\"),h.push(f(n)),h.push(\"=\"),h.push(f(g[n]));h.push(\"&emsg=\");h.push(f(d.name+\":\"+d.message));var k=h.join(\"\");va(k)&&\n(k=k.substr(0,2E3));c=k;var t=window.gbar.logger._aem(a,c);qa(t)}}catch(z){}}var va=function(a){return 2E3<=a.length},wa=function(a,b){return b};function xa(a){H=a;m(\"_itl\",va,J);m(\"_aem\",wa,J);m(\"ml\",H,J);a={};p.er=a}l.a(\"\")?xa(function(a){throw a;}):l.a(\"1\")&&Math.random()<ta&&xa(_mlToken);var _E=\"left\",L=funct"
        Timeout::Error: execution expired (IO.select == nil)
             rbuf_fill at google_ssl_test.rb:12
                  read at /home/zaadjis/.rvm/rubies/jruby-head/lib/ruby/1.8/net/protocol.rb:86
          read_chunked at /home/zaadjis/.rvm/rubies/jruby-head/lib/ruby/1.8/net/http.rb:2238
           read_body_0 at /home/zaadjis/.rvm/rubies/jruby-head/lib/ruby/1.8/net/http.rb:2213
             read_body at /home/zaadjis/.rvm/rubies/jruby-head/lib/ruby/1.8/net/http.rb:2179
                  body at /home/zaadjis/.rvm/rubies/jruby-head/lib/ruby/1.8/net/http.rb:2204
          reading_body at /home/zaadjis/.rvm/rubies/jruby-head/lib/ruby/1.8/net/http.rb:2143
               request at /home/zaadjis/.rvm/rubies/jruby-head/lib/ruby/1.8/net/http.rb:1053
              __file__ at google_ssl_test.rb:24
                 start at /home/zaadjis/.rvm/rubies/jruby-head/lib/ruby/1.8/net/http.rb:543
                (root) at google_ssl_test.rb:24
        
        Show
        zaadjis added a comment - Reproducable with jruby master: $ ruby --version jruby 1.7.0.dev (ruby-1.8.7-p357) (2012-03-15 860f429) (OpenJDK 64-Bit Server VM 1.7.0_147-icedtea) [linux-amd64-java] $ ruby google_ssl_test.rb opening connection to encrypted.google.com... ..snip.. -> "=!vyotO9-rkdSNh-QZgw/d=1/\";F.ms=\"https://apis.google.com\";F.m=\"\";F.l=[];q.push([\"gl\",{url:\"//ssl.gstatic.com/gb/js/abc/glm_2572388ad06f10d8fe6ef9a09f798c5d.js\"}]);var ka={\"export\":C};p.gl=ka;C&&m(\"load\",E,ia);var la=/^m;/.test(F.h)&&!/\\/gapi\\/|ms=gapi/.test(F.h)?D:E;m(\"dgl\",la);m(\"agl\",ja)};var H=function(){},I=function(){},qa=function(a){var b=new Image,c=ma;b.onerror=b.onload=b.onabort=function(){try{delete na[c]}catch(a){}};na[c]=b;b.src=a;ma=c+1},na=[],ma=0;m(\"logger\",{il:I,ml:H});var J=window.gbar.logger;var ta=l.b(\"0.01\",1.0E-4),ua=0;\nfunction _mlToken(a,b){try{if(1>ua){ua++;var c,d=a,g=b||{},f=encodeURIComponent,h=[\"//www.google.com/gen_204?atyp=i&zx=\",(new Date).getTime(),\"&jexpid=\",f(\"30316\"),\"&srcpg=\",f(\"prop=1\"),\"&jsr=\",Math.round(1/ta),\"&ogf=\",j.bv.f,\"&ogv=\",f(\"1331585407.1331740271\"),\"&ogd=\",f(\"com\"),\"&ogl=\",f(\"en\")];g._sn&&(g._sn=\"og.\"+g._sn);for(var n in g)h.push(\"&\"),h.push(f(n)),h.push(\"=\"),h.push(f(g[n]));h.push(\"&emsg=\");h.push(f(d.name+\":\"+d.message));var k=h.join(\"\");va(k)&&\n(k=k.substr(0,2E3));c=k;var t=window.gbar.logger._aem(a,c);qa(t)}}catch(z){}}var va=function(a){return 2E3<=a.length},wa=function(a,b){return b};function xa(a){H=a;m(\"_itl\",va,J);m(\"_aem\",wa,J);m(\"ml\",H,J);a={};p.er=a}l.a(\"\")?xa(function(a){throw a;}):l.a(\"1\")&&Math.random()<ta&&xa(_mlToken);var _E=\"left\",L=funct" Timeout::Error: execution expired (IO.select == nil) rbuf_fill at google_ssl_test.rb:12 read at /home/zaadjis/.rvm/rubies/jruby-head/lib/ruby/1.8/net/protocol.rb:86 read_chunked at /home/zaadjis/.rvm/rubies/jruby-head/lib/ruby/1.8/net/http.rb:2238 read_body_0 at /home/zaadjis/.rvm/rubies/jruby-head/lib/ruby/1.8/net/http.rb:2213 read_body at /home/zaadjis/.rvm/rubies/jruby-head/lib/ruby/1.8/net/http.rb:2179 body at /home/zaadjis/.rvm/rubies/jruby-head/lib/ruby/1.8/net/http.rb:2204 reading_body at /home/zaadjis/.rvm/rubies/jruby-head/lib/ruby/1.8/net/http.rb:2143 request at /home/zaadjis/.rvm/rubies/jruby-head/lib/ruby/1.8/net/http.rb:1053 __file__ at google_ssl_test.rb:24 start at /home/zaadjis/.rvm/rubies/jruby-head/lib/ruby/1.8/net/http.rb:543 (root) at google_ssl_test.rb:24
        Hide
        Charles Oliver Nutter added a comment -

        Confirmed, but I'm not sure what the problem is yet. It appears that it gets stuck selecting on read when data should be there, eh? But selecting for write seems to help it, so perhaps there's some writing we need to do to get the next readable data to come through?

        Show
        Charles Oliver Nutter added a comment - Confirmed, but I'm not sure what the problem is yet. It appears that it gets stuck selecting on read when data should be there, eh? But selecting for write seems to help it, so perhaps there's some writing we need to do to get the next readable data to come through?
        Hide
        Matt Hauck added a comment -

        If this is still unresolved, why is it marked as fixed for jruby-1.7rc1?

        Show
        Matt Hauck added a comment - If this is still unresolved, why is it marked as fixed for jruby-1.7rc1?
        Hide
        Charles Oliver Nutter added a comment -

        Matt: We usually mark "Fix Version" as a goal. This one obviously slipped from RC1 (and probably won't make it into 1.7.0 final at this point).

        Show
        Charles Oliver Nutter added a comment - Matt: We usually mark "Fix Version" as a goal. This one obviously slipped from RC1 (and probably won't make it into 1.7.0 final at this point).
        Hide
        Matt Hauck added a comment -

        Sorry I wasn't clear. I was referring to the release notes on jruby.org.

        Show
        Matt Hauck added a comment - Sorry I wasn't clear. I was referring to the release notes on jruby.org.
        Hide
        Charles Oliver Nutter added a comment -

        Matt: Oh, I guess we included unresolved issues in that list accidentally. Thanks for pointing that out.

        Show
        Charles Oliver Nutter added a comment - Matt: Oh, I guess we included unresolved issues in that list accidentally. Thanks for pointing that out.

          People

          • Assignee:
            Unassigned
            Reporter:
            zaadjis
          • Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated: