Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.5.6, JRuby 1.6.6, JRuby 1.6.7
-
Fix Version/s: JRuby 1.7.0.pre2
-
Component/s: Interpreter, Ruby 1.8.7
-
Labels:None
-
Environment:$ java -version
java version "1.6.0_23"
OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre11-0ubuntu1.11.10.1)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)
-
Number of attachments :
Description
Calling a dynamically generated method (defined using `define_method(:method)
{ ..body.. }` ) having `require 'ruby-debug'; debugger` inside it throws
Java::JavaLang::NullPointerException: from org.jruby.ast.RescueNode.handleJavaException(RescueNode.java:206) from org.jruby.ast.RescueNode.interpretWithJavaExceptions(RescueNode.java:141) from org.jruby.ast.RescueNode.interpret(RescueNode.java:110) from org.jruby.ast.DAsgnNode.interpret(DAsgnNode.java:110) from org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) from org.jruby.ast.BlockNode.interpret(BlockNode.java:71) ...
Without `require 'ruby-debug'; debugger` in method body the call just returns nil without executing the method body. The following pastie tries to clarify the setup (sadly without reproducing the issue) http://pastie.org/private/ivtgoimsy9px8qftklm0w
The following pasties are Rails 2.3.9 console sessions manifesting the problem with different JRubies
http://pastie.org/private/gwx0g9tz6yzytmqs2s2jnq
http://pastie.org/private/ycc8hmwjiyicfhsppslhw
http://pastie.org/private/h2kr22mujqts2qilknhiig
Console is launched
$ jruby --server -J-Xms512m -J-Xmx512m -J-Xmn128m -J-Djruby.thread.pooling=true console.rb development
The line of code in question confuses me. It should not cause NPE unless something is seriously misconfigured in the JVM.
Here's the line of code:
UnsafeFactory should be using a piece of code we generate in our build called GeneratedUnsafe. You should be able to find that in the jruby.jar file.
This is the second report I've had of this problem, so I don't doubt that it's real.
Are you able to build JRuby? If so, you could check out the jruby-1_6 branch and modify src/org/jruby/util/unsafe/UnsafeFactory.java setting the static DEBUG field to true. That would print out what's happening in there at startup; I assume we'll see an exception trace.