Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.1.3
-
Fix Version/s: JRuby 1.2
-
Component/s: Core Classes/Modules
-
Labels:None
-
Environment:Linux amd64 Sun jre 1.6
-
Testcase included:yes
Description
For me the attached code locks up within few iterations, and sometimes throws a NULL pointer exception.
ava.lang.NullPointerException
at org.jruby.util.io.OpenFile.finalize(OpenFile.java:241)
at org.jruby.util.io.OpenFile.cleanup(OpenFile.java:226)
at org.jruby.RubyIO.close2(RubyIO.java:1684)
at org.jruby.RubyIO.close(RubyIO.java:1662)
at org.jruby.RubyIOInvoker$close_method_0_0.call(Unknown Source)
at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:123)
at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:333)
at ruby.Users.hramrach.testt2.rescue_2$RUBY$_rescue_(testt2.rb)
at ruby.Users.hramrach.testt2.method__0$RUBY$try_analyze(testt2.rb:16)
at ruby.Users.hramrach.testt2Invokermethod__0$RUBY$try_analyzeOpt.call(Unknown
Source)
at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:134)
at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:111)
at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:282)
at ruby.Users.hramrach.testt2.block_3$RUBY$_block_(testt2.rb:21)
at ruby.Users.hramrach.testt2BlockCallback$block_3$RUBY$_block_xx1.call(Unknown
Source)
at org.jruby.runtime.CompiledBlock.yield(CompiledBlock.java:100)
at org.jruby.runtime.Block.yield(Block.java:100)
at org.jruby.RubyInteger.upto(RubyInteger.java:122)
at org.jruby.RubyIntegerInvoker$upto_method_1_0.call(Unknown Source)
at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:159)
at org.jruby.runtime.CallSite$InlineCachingCallSite.callIter(CallSite.java:415)
at ruby.Users.hramrach.testt2._file_(testt2.rb:20)
at ruby.Users.hramrach.testt2._file_(testt2.rb)
at ruby.Users.hramrach.testt2.load(testt2.rb)
at org.jruby.Ruby.runScript(Ruby.java:541)
at org.jruby.Ruby.runNormally(Ruby.java:454)
at org.jruby.Ruby.runFromMain(Ruby.java:327)
at org.jruby.Main.run(Main.java:194)
at org.jruby.Main.run(Main.java:91)
at org.jruby.Main.main(Main.java:82)
I cleaned up some logic that should prevent the exceptions you were seeing, but the script is a little problematic; you have a thread spinning away writing to the descriptor and then you close it at some indeterminate time in the future. It's probably expected that you should see some exceptional behavior since it could be in the middle of a write when it's closed. You may want to sync up with the thread a bit more aggressively. At any rate, script seems to run well now. Can you come up with something we could include as a test case?