Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.7.0.pre1
-
Fix Version/s: JRuby 1.7.0.pre1
-
Component/s: None
-
Labels:None
-
Testcase included:yes
-
Number of attachments :
Description
As of commit 46c59ad659136fbda7c7fcd77b8bb47180f424f0 you can no longer use a JRuby runtime across multiple Java threads when using 1.9 mode because the ThreadLocal variable recursiveKey only gets initialized once when the runtime is initialized. So, as soon as I pass an initialzed runtime to a new thread recursiveKey has no value and results in an NPE like:
java.lang.NullPointerException
at org.jruby.RubyHash.internalGetEntry(RubyHash.java:506) [jruby.jar:]
at org.jruby.RubyHash.internalGet(RubyHash.java:502) [jruby.jar:]
at org.jruby.RubyHash.fastARef(RubyHash.java:942) [jruby.jar:]
at org.jruby.Ruby.recursiveCheck(Ruby.java:3765) [jruby.jar:]
at org.jruby.Ruby.execRecursiveInternal(Ruby.java:3801) [jruby.jar:]
at org.jruby.Ruby.execRecursiveOuter(Ruby.java:3876) [jruby.jar:]
at org.jruby.RubyArray.hash19(RubyArray.java:694) [jruby.jar:]\
JUnit TestCase at https://gist.github.com/2494050
Issue Links
- is duplicated by
-
JRUBY-6618
NPEs on CI spec run on master
-
Pull request with fix and testcase at https://github.com/jruby/jruby/pull/144