Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Running httpclient test with JRuby master dumps NPE log. Stacktrace says TCPServer#accept -> IO#select accesses unprotected field 'fd' in OpenFile. This commit changes IO#select to check if a file is closed or not first. I don't have a short reproducer. Following is the step to reproduce. % git clone https://github.com/nahi/httpclient.git % cd httpclient % jruby -Ilib test/test_httpclient.rb -n test_keepalive_disconnected Loaded suite test/test_httpclient Started shed in 0.141 seconds. 1 tests, 21 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed 7.09 tests/s, 148.94 assertions/s Exception in thread "Ruby-0-Thread-4: /Users/nahi/git-private/jruby/lib/ruby/stdlib/test/unit/testcase.rb:697" java.lang.NullPointerException at org.jruby.util.io.OpenFile.channel(OpenFile.java:2250) at org.jruby.RubyIO.getChannel(RubyIO.java:402) at org.jruby.RubyThread.select(RubyThread.java:1521) at org.jruby.ext.socket.RubyTCPServer.accept(RubyTCPServer.java:146) at org.jruby.ext.socket.RubyTCPServer$INVOKER$i$0$0$accept.call(RubyTCPServer$INVOKER$i$0$0$accept.gen) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:129) at test.test_httpclient.invokeOther7155:accept(test/test_httpclient.rb) at test.test_httpclient.RUBY$block$test_keepalive_disconnected$303(test/test_httpclient.rb:1682) at org.jruby.runtime.CompiledIRBlockBody.commonYieldPath(CompiledIRBlockBody.java:70) at org.jruby.runtime.IRBlockBody.call(IRBlockBody.java:59) at org.jruby.runtime.Block.call(Block.java:106) at org.jruby.RubyProc.call(RubyProc.java:334) at org.jruby.RubyProc.call(RubyProc.java:240) at org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:99) at java.lang.Thread.run(Thread.java:745)