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

Fix TCPServer#accept NPE log #3444

Merged
merged 1 commit into from Nov 3, 2015
Merged

Fix TCPServer#accept NPE log #3444

merged 1 commit into from Nov 3, 2015

Conversation

@nahi
Copy link
Member

@nahi nahi commented Nov 3, 2015

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)
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)
@enebo enebo added this to the JRuby 9.0.4.0 milestone Nov 3, 2015
enebo added a commit that referenced this issue Nov 3, 2015
@enebo enebo merged commit 06d4ba6 into master Nov 3, 2015
1 check passed
@kares kares deleted the fix_socket_accept_NPE branch Jan 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants