United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 7094138 JSR 292: JRuby junit test fails in CallSite.setTargetNormal: obj->is_oop() failed: sanity check
7094138 : JSR 292: JRuby junit test fails in CallSite.setTargetNormal: obj->is_oop() failed: sanity check

Details
Type:
Bug
Submit Date:
2011-09-23
Status:
Closed
Updated Date:
2012-03-22
Project Name:
JDK
Resolved Date:
2012-01-23
Component:
hotspot
OS:
generic
Sub-Component:
compiler
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
hs23
Fixed Versions:
hs23

Related Reports
Backport:
Backport:

Sub Tasks

Description
$ cd jruby
$ ant clean jar compile-test run-junit-precompiled
...
    [junit] junit.framework.TestListener: startTest(test_io)
    [junit] # To suppress the following error report, specify this argument
    [junit] # after -XX: or in .hotspotrc:  SuppressErrorAt=/handles.cpp:46
    [junit] #
    [junit] # A fatal error has been detected by the Java Runtime Environment:
    [junit] #
    [junit] #  Internal Error (/home/ct232829/hsx/hotspot-comp/7092712/src/share/vm/runtime/handles.cpp:46), pid=27921, tid=3171941232
    [junit] #  assert(SharedSkipVerify || obj->is_oop()) failed: sanity check
    [junit] #
    [junit] # JRE version: 7.0_02-b07
    [junit] # Java VM: Java HotSpot(TM) Client VM (23.0-b01-internal-fastdebug mixed mode linux-x86 )
    [junit] # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
    [junit] #
    [junit] [thread -1059394704 also had an error]
    [junit] # An error report file with more information is saved as:
    [junit] # [thread -1059394704 also had an error]
    [junit] #
    [junit] # If you would like to submit a bug report, please visit:
    [junit] #   http://bugreport.sun.com/bugreport/crash.jsp
    [junit] #

Stack traces from hs_err file:

---------------  T H R E A D  ---------------

Current thread (0xbdf2e400):  JavaThread "RubyThread-195: test/test_io_generated_test.rb:4" daemon [_thread_in_vm, id=21000, stack(0xbd0af000,0xbd100000)]

Stack: [0xbd0af000,0xbd100000],  sp=0xbd0fe66c,  free space=317k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x766ad7]  VMError::report_and_die()+0x197
V  [libjvm.so+0x2fb6e4]  report_vm_error(char const*, int, char const*, char const*)+0x64
V  [libjvm.so+0x3949cd]  HandleArea::allocate_handle(oopDesc*)+0x8d
V  [libjvm.so+0x259270]  Handle::Handle(oopDesc*)+0x40
V  [libjvm.so+0x3ea19e]  InterpreterRuntime::resolve_get_put(JavaThread*, Bytecodes::Code)+0x6ae
j  java.lang.invoke.CallSite.setTargetNormal(Ljava/lang/invoke/MethodHandle;)V+2
J  java.lang.invoke.MutableCallSite.setTarget(Ljava/lang/invoke/MethodHandle;)V
j  org.jruby.runtime.invokedynamic.InvocationLinker.invocationFallback(Lorg/jruby/runtime/invokedynamic/JRubyCallSite;Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Ljava/lang/Stri
ng;Lorg/jruby/runtime/Block;)Lorg/jruby/runtime/builtin/IRubyObject;+152
j  $_dot_.test.test_io.block_44$RUBY$test_multithreaded_writes(L$_dot_/test/test_io;Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/Block;)Lorg/jruby/runtime/buil
tin/IRubyObject;+41
j  $_dot_$test$test_io$block_44$RUBY$test_multithreaded_writes.call(Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/Block;)Lorg/jruby/runtime/builtin/IRubyObject;
+9
j  org.jruby.runtime.CompiledBlock.yield(Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/RubyModule;ZLorg/jruby/runtime/Binding;Lorg/jruby/runtime/Block$Type;Lorg/jruby/r
untime/Block;)Lorg/jruby/runtime/builtin/IRubyObject;+70
j  org.jruby.runtime.BlockBody.call(Lorg/jruby/runtime/ThreadContext;[Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/Binding;Lorg/jruby/runtime/Block$Type;Lorg/jruby/runtime/Block;)Lorg/jruby/runtime/builtin/IRubyObject;+27
j  org.jruby.runtime.Block.call(Lorg/jruby/runtime/ThreadContext;[Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/Block;)Lorg/jruby/runtime/builtin/IRubyObject;+15
j  org.jruby.RubyProc.call(Lorg/jruby/runtime/ThreadContext;[Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/Block;)Lorg/jruby/runtime/builtin/IRubyObject;+59
j  org.jruby.RubyProc.call(Lorg/jruby/runtime/ThreadContext;[Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;+7
j  org.jruby.internal.runtime.RubyRunnable.run()V+100
j  java.lang.Thread.run()V+11
v  ~StubRoutines::call_stub
V  [libjvm.so+0x3f7c2c]  JavaCalls::call_helper(JavaValue*, methodHandle*, JavaCallArguments*, Thread*)+0x65c
V  [libjvm.so+0x606309]  os::os_exception_wrapper(void (*)(JavaValue*, methodHandle*, JavaCallArguments*, Thread*), JavaValue*, methodHandle*, JavaCallArguments*, Thread*)+0x19
V  [libjvm.so+0x3f7f42]  JavaCalls::call_virtual(JavaValue*, KlassHandle, Symbol*, Symbol*, JavaCallArguments*, Thread*)+0x182
V  [libjvm.so+0x3f8171]  JavaCalls::call_virtual(JavaValue*, Handle, KlassHandle, Symbol*, Symbol*, Thread*)+0x61
V  [libjvm.so+0x46feb2]  thread_entry(JavaThread*, Thread*)+0x92
V  [libjvm.so+0x71d964]  JavaThread::thread_main_inner()+0xf4
V  [libjvm.so+0x610681]  java_start(Thread*)+0x121
C  [libpthread.so.0+0x69e9]  start_thread+0xc9

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  java.lang.invoke.CallSite.setTargetNormal(Ljava/lang/invoke/MethodHandle;)V+2
J  java.lang.invoke.MutableCallSite.setTarget(Ljava/lang/invoke/MethodHandle;)V
j  org.jruby.runtime.invokedynamic.InvocationLinker.updateInvocationTarget(Ljava/lang/invoke/MethodHandle;Lorg/jruby/runtime/invokedynamic/JRubyCallSite;Lorg/jruby/RubyModule;Ljava/lang/String;Lorg/jruby/runtime/callsite/CacheEntry;ZI)Ljava/lang/invoke/MethodHandle;+214
j  org.jruby.runtime.invokedynamic.InvocationLinker.invocationFallback(Lorg/jruby/runtime/invokedynamic/JRubyCallSite;Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Ljava/lang/String;Lorg/jruby/runtime/Block;)Lorg/jruby/runtime/builtin/IRubyObject;+152
j  $_dot_.test.test_io.block_44$RUBY$test_multithreaded_writes(L$_dot_/test/test_io;Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/Block;)Lorg/jruby/runtime/builtin/IRubyObject;+41
j  $_dot_$test$test_io$block_44$RUBY$test_multithreaded_writes.call(Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/Block;)Lorg/jruby/runtime/builtin/IRubyObject;+9
j  org.jruby.runtime.CompiledBlock.yield(Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/RubyModule;ZLorg/jruby/runtime/Binding;Lorg/jruby/runtime/Block$Type;Lorg/jruby/runtime/Block;)Lorg/jruby/runtime/builtin/IRubyObject;+70
j  org.jruby.runtime.BlockBody.call(Lorg/jruby/runtime/ThreadContext;[Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/Binding;Lorg/jruby/runtime/Block$Type;Lorg/jruby/runtime/Block;)Lorg/jruby/runtime/builtin/IRubyObject;+27
j  org.jruby.runtime.Block.call(Lorg/jruby/runtime/ThreadContext;[Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/Block;)Lorg/jruby/runtime/builtin/IRubyObject;+15
j  org.jruby.RubyProc.call(Lorg/jruby/runtime/ThreadContext;[Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/Block;)Lorg/jruby/runtime/builtin/IRubyObject;+59
j  org.jruby.RubyProc.call(Lorg/jruby/runtime/ThreadContext;[Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;+7
j  org.jruby.internal.runtime.RubyRunnable.run()V+100
j  java.lang.Thread.run()V+11
v  ~StubRoutines::call_stub

                                    

Comments
EVALUATION

http://hg.openjdk.java.net/lambda/lambda/hotspot/rev/12d38ffcba2a
                                     
2012-03-22
EVALUATION

See main CR
                                     
2011-11-30
EVALUATION

http://hg.openjdk.java.net/hsx/hotspot-emb/hotspot/rev/12d38ffcba2a
                                     
2011-11-29
EVALUATION

http://hg.openjdk.java.net/hsx/hotspot-rt/hotspot/rev/12d38ffcba2a
                                     
2011-11-15
EVALUATION

http://hg.openjdk.java.net/hsx/hotspot-comp/hotspot/rev/12d38ffcba2a
                                     
2011-10-25
EVALUATION

InterpreterRuntime::resolve_get_put and MHN_setCallSiteTargetNormal/MHN_setCallSiteTargetVolatile are calling Universe::flush_dependents_on under the Compile_lock to make sure the CallSite target values don't change during a compile in flight.  But both arguments for call_site and target are not held in a Handle but a plain oop.  This can result in stale oops.
                                     
2011-10-21
EVALUATION

For about 50% of the runs with a linux-x64 fastdebug build we get:

###@###.###:~/mlvm/jruby$ jruby -J-showversion -J-d64 --server -J-XX:+UseCompressedOops -J-Xcomp -J-XX:+DeoptimizeRandom test/test_respond_to.rb
VM option '+UseCompressedOops'
VM option '+DeoptimizeRandom'
java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-b09)
Java HotSpot(TM) 64-Bit Server VM (build 23.0-b03-internal-fastdebug, compiled mode)

Warning: Handler @13 takes mixed loaded/unloaded exceptions in static jboolean java.lang.Boolean.getBoolean(jobject)
Warning: Handler @13 takes mixed loaded/unloaded exceptions in static jboolean java.lang.Boolean.getBoolean(jobject)
Warning: Handler @10 takes mixed loaded/unloaded exceptions in static jobject java.lang.Integer.getInteger(jobject, jobject)
Warning: Handler @31 takes mixed loaded/unloaded exceptions in virtual jobject sun.reflect.MethodAccessorGenerator$1.run()
Warning: Handler @31 takes mixed loaded/unloaded exceptions in virtual jobject sun.reflect.MethodAccessorGenerator$1.run()
Warning: Handler @31 takes mixed loaded/unloaded exceptions in virtual jobject sun.reflect.MethodAccessorGenerator$1.run()
Loaded suite test/test_respond_to
Started
.# To suppress the following error report, specify this argument
# after -XX: or in .hotspotrc:  SuppressErrorAt=/oop.inline.hpp:213
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/home/ct232829/hsx/hotspot-comp/7094138/src/share/vm/oops/oop.inline.hpp:213), pid=31503, tid=139666734753552
#  assert(check_obj_alignment(result)) failed: address not aligned: 0x00000000baadbabe
#
# JRE version: 8.0-b09
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.0-b03-internal-fastdebug compiled mode linux-amd64 compressed oops)
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/ct232829/mlvm/jruby/hs_err_pid31503.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
#
Current thread is 139666734753552
Dumping core ...
Aborted (core dumped)
                                     
2011-10-18
EVALUATION

Still reproducible with the latest deopt fixes.
                                     
2011-10-12
EVALUATION

The same bug happens with C1 and C2.
                                     
2011-10-12
EVALUATION

When running with the JDK changes for 7085860 the assert stays the same:

---------------  T H R E A D  ---------------

Current thread (0xbe713800):  JavaThread "RubyThread-193: test/test_io_generated_test.rb:4" daemon [_thread_in_vm, id=882, stack(0xbd60d000,0xbd65e000)]

Stack: [0xbd60d000,0xbd65e000],  sp=0xbd65c0b0,  free space=316k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x766ad7]  VMError::report_and_die()+0x197
V  [libjvm.so+0x2fb6e4]  report_vm_error(char const*, int, char const*, char const*)+0x64
V  [libjvm.so+0x3949cd]  HandleArea::allocate_handle(oopDesc*)+0x8d
V  [libjvm.so+0x59e2e2]  MHN_setCallSiteTargetNormal+0x1a2
J  java.lang.invoke.MethodHandleNatives.setCallSiteTargetNormal(Ljava/lang/invoke/CallSite;Ljava/lang/invoke/MethodHandle;)V
j  java.lang.invoke.CallSite.setTargetNormal(Ljava/lang/invoke/MethodHandle;)V+2
J  java.lang.invoke.MutableCallSite.setTarget(Ljava/lang/invoke/MethodHandle;)V
J  java.lang.invoke.CallSite.makeSite(Ljava/lang/invoke/MethodHandle;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/Object;Ljava/lang/invoke/MemberName;I)Ljava/lang/invoke/CallSite;

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
J  java.lang.invoke.MethodHandleNatives.setCallSiteTargetNormal(Ljava/lang/invoke/CallSite;Ljava/lang/invoke/MethodHandle;)V
j  java.lang.invoke.CallSite.setTargetNormal(Ljava/lang/invoke/MethodHandle;)V+2
J  java.lang.invoke.MutableCallSite.setTarget(Ljava/lang/invoke/MethodHandle;)V
j  org.jruby.runtime.invokedynamic.InvocationLinker.invocationBootstrap(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;+364
J  java.lang.invoke.CallSite.makeSite(Ljava/lang/invoke/MethodHandle;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/Object;Ljava/lang/invoke/MemberName;I)Ljava/lang/invoke/CallSite;
J  java.lang.invoke.MethodHandleNatives.makeDynamicCallSite(Ljava/lang/invoke/MethodHandle;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/Object;Ljava/lang/invoke/MemberName;I)Ljava/lang/invoke/CallSite;
v  ~StubRoutines::call_stub
j  $_dot_.test.test_io.block_45$RUBY$test_multithreaded_writes(L$_dot_/test/test_io;Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/Block;)Lorg/jruby/runtime/builtin/IRubyObject;+47
j  $_dot_$test$test_io$block_45$RUBY$test_multithreaded_writes.call(Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/Block;)Lorg/jruby/runtime/builtin/IRubyObject;+9
J  org.jruby.runtime.CompiledBlock.yield(Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/Binding;Lorg/jruby/runtime/Block$Type;Lorg/jruby/runtime/Block;)Lorg/jruby/runtime/builtin/IRubyObject;
J  org.jruby.runtime.CompiledBlock.yield(Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/Binding;Lorg/jruby/runtime/Block$Type;)Lorg/jruby/runtime/builtin/IRubyObject;
J  org.jruby.RubyFixnum.times(Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/Block;)Lorg/jruby/runtime/builtin/IRubyObject;
J  java.lang.invoke.MethodHandleImpl$GuardWithCatch.invoke_L5(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
J  java.lang.invoke.MethodHandleImpl$GuardWithCatch.invoke_L5(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
v  ~RichochetBlob
J  java.lang.invoke.MethodHandle.invokeWithArguments([Ljava/lang/Object;)Ljava/lang/Object;
j  org.jruby.runtime.invokedynamic.InvocationLinker.invocationFallback(Lorg/jruby/runtime/invokedynamic/JRubyCallSite;Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Ljava/lang/String;Lorg/jruby/runtime/Block;)Lorg/jruby/runtime/builtin/IRubyObject;+185
j  $_dot_.test.test_io.block_44$RUBY$test_multithreaded_writes(L$_dot_/test/test_io;Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/Block;)Lorg/jruby/runtime/builtin/IRubyObject;+41
j  $_dot_$test$test_io$block_44$RUBY$test_multithreaded_writes.call(Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/Block;)Lorg/jruby/runtime/builtin/IRubyObject;+9
j  org.jruby.runtime.CompiledBlock.yield(Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/RubyModule;ZLorg/jruby/runtime/Binding;Lorg/jruby/runtime/Block$Type;Lorg/jruby/runtime/Block;)Lorg/jruby/runtime/builtin/IRubyObject;+70
j  org.jruby.runtime.BlockBody.call(Lorg/jruby/runtime/ThreadContext;[Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/Binding;Lorg/jruby/runtime/Block$Type;Lorg/jruby/runtime/Block;)Lorg/jruby/runtime/builtin/IRubyObject;+27
J  org.jruby.RubyProc.call(Lorg/jruby/runtime/ThreadContext;[Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/Block;)Lorg/jruby/runtime/builtin/IRubyObject;
j  org.jruby.RubyProc.call(Lorg/jruby/runtime/ThreadContext;[Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;+7
j  org.jruby.internal.runtime.RubyRunnable.run()V+100
j  java.lang.Thread.run()V+11
v  ~StubRoutines::call_stub
                                     
2011-09-23



Hardware and Software, Engineered to Work Together