JDK-8008511 : JSR 292: MemberName vmtarget refs to methods must be updated at class redefinition
  • Type: Bug
  • Component: hotspot
  • Sub-Component: jvmti
  • Affected Version: hs24,hs25,7u60
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2013-02-20
  • Updated: 2014-10-15
  • Resolved: 2013-04-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8 Other
7u60Fixed 8Fixed hs25Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
The following two INDY tests fail because of this issue:
   vm/mlvm/indy/func/jvmti/redefineClassInBootstrap
   vm/mlvm/indy/func/jvmti/redefineClassInTarget


with the following exception:

[2013-02-20T02:10:50.16] Original bootstrap(): Lookup vm.mlvm.indy.func.jvmti.redefineClassInBootstrap.INDIFY_Dummy0; method name = greet; method type = (Object,String,int)Boolean
[2013-02-20T02:10:50.16] Original bootstrap(): Lookup vm.mlvm.indy.func.jvmti.redefineClassInBootstrap.INDIFY_Dummy0; method name = greet; method type = (Object,String,int)Boolean
[2013-02-20T02:10:50.16] # ERROR: Test caught an exception: 
[2013-02-20T02:10:50.16] # ERROR: java.lang.reflect.InvocationTargetException
[2013-02-20T02:10:50.16] # ERROR:       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2013-02-20T02:10:50.16] # ERROR:       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[2013-02-20T02:10:50.17] # ERROR:       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[2013-02-20T02:10:50.17] # ERROR:       at java.lang.reflect.Method.invoke(Method.java:487)
[2013-02-20T02:10:50.17] # ERROR:       at vm.mlvm.indy.func.jvmti.share.IndyRedefineTest.run(IndyRedefineTest.java:30)
[2013-02-20T02:10:50.17] # ERROR:       at vm.mlvm.share.MlvmTest.runMlvmTest(MlvmTest.java:195)
[2013-02-20T02:10:50.17] # ERROR:       at vm.mlvm.share.MlvmTest.launch(MlvmTest.java:133)
[2013-02-20T02:10:50.17] # ERROR:       at vm.mlvm.share.MlvmTest.launch(MlvmTest.java:107)
[2013-02-20T02:10:50.17] # ERROR:       at vm.mlvm.indy.func.jvmti.share.IndyRedefineTest.main(IndyRedefineTest.java:44)
[2013-02-20T02:10:50.17] # ERROR: Caused by: java.lang.BootstrapMethodError: call site initialization exception
[2013-02-20T02:10:50.17] # ERROR:       at java.lang.invoke.CallSite.makeSite(CallSite.java:298)
[2013-02-20T02:10:50.17] # ERROR:       at java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:294)
[2013-02-20T02:10:50.17] # ERROR:       at vm.mlvm.indy.func.jvmti.redefineClassInBootstrap.INDIFY_Dummy0.bootstrap(Unknown Source)
[2013-02-20T02:10:50.17] # ERROR:       ... 9 more
[2013-02-20T02:10:50.17] # ERROR: Caused by: java.lang.RuntimeException: Bootstrap method has not been redefined. Test failed.
[2013-02-20T02:10:50.19] # ERROR:       at vm.mlvm.indy.func.jvmti.redefineClassInBootstrap.INDIFY_Dummy0.bootstrap(Unknown Source)
[2013-02-20T02:10:50.19] # ERROR:       at java.lang.invoke.CallSite.makeSite(CallSite.java:270)
[2013-02-20T02:10:50.19] # ERROR:       ... 11 more
[2013-02-20T02:10:50.19] ### TRACE 1: TEST FAILED


The problem is that the old version of the bootstrap method is re-invoked after a popframe from
the bootstrap method execution.
It is because the MemberName keeps a stale reference to the old method version.

This is the last issue which prevents the tests above to pass.
In fact, they pass with my prototype of the fix.

This is a log when the test test is passed with a temporary fix:

cat /net/sc11152596/export/home/sspitsyn/tst/nskx/.February19,.sparc/sspitsyn.SunOS.sparc/redefineClassInBootstrap/redefineClassInBootstrap.log
#
[2013-02-20T02:08:20.96] export TESTED_JAVA_HOME
[2013-02-20T02:08:20.96] export SYSTEMROOT
[2013-02-20T02:08:20.96] export HOME
[2013-02-20T02:08:20.96] export TEMP
[2013-02-20T02:08:20.96] export RAS_OPTIONS
[2013-02-20T02:08:20.96] export BASH_ENV
[2013-02-20T02:08:20.96] export SHELL
[2013-02-20T02:08:20.96] export TEST_CLEANUP
[2013-02-20T02:08:20.96] export LIBJSIG_PATH
[2013-02-20T02:08:20.96] export CLASSPATH
[2013-02-20T02:08:20.96] export ROOTDIR
[2013-02-20T02:08:20.96] export JAVA_OPTS
[2013-02-20T02:08:20.96] export DISPLAY
[2013-02-20T02:08:20.96] export WINDIR
[2013-02-20T02:08:20.96] export PATH
[2013-02-20T02:08:20.96] export JAVA_64_BITS
[2013-02-20T02:08:20.96] export LD_LIBRARY_PATH
[2013-02-20T02:08:20.96] export TESTBASE
[2013-02-20T02:08:20.96] TEST_DEST_DIR="redefineClassInBootstrap"
[2013-02-20T02:08:21.02] # Actual: TEST_DEST_DIR=redefineClassInBootstrap
[2013-02-20T02:08:21.02] TESTNAME="${test_case_name}"
[2013-02-20T02:08:21.02] # Actual: TESTNAME=redefineClassInBootstrap
[2013-02-20T02:08:21.02] testName="vm/mlvm/indy/func/jvmti//redefineClassInBootstrap"
[2013-02-20T02:08:21.02] # Actual: testName=vm/mlvm/indy/func/jvmti//redefineClassInBootstrap
[2013-02-20T02:08:21.02] TESTDIR="${test_work_dir}"
[2013-02-20T02:08:21.02] # Actual: TESTDIR=/net/sc11152596/export/home/sspitsyn/tst/nskx/.February19,.sparc/sspitsyn.SunOS.sparc/redefineClassInBootstrap
[2013-02-20T02:08:21.02] testWorkDir="${test_work_dir}/"
[2013-02-20T02:08:21.02] # Actual: testWorkDir=/net/sc11152596/export/home/sspitsyn/tst/nskx/.February19,.sparc/sspitsyn.SunOS.sparc/redefineClassInBootstrap/
[2013-02-20T02:08:21.02] export testWorkDir
[2013-02-20T02:08:21.02] tlogOutFile="${test_work_dir}/${test_name}.tlog"
[2013-02-20T02:08:21.02] # Actual: tlogOutFile=/net/sc11152596/export/home/sspitsyn/tst/nskx/.February19,.sparc/sspitsyn.SunOS.sparc/redefineClassInBootstrap/redefineClassInBootstrap.tlog
[2013-02-20T02:08:21.02] testErrFile="${test_work_dir}/${test_name}.err"
[2013-02-20T02:08:21.02] # Actual: testErrFile=/net/sc11152596/export/home/sspitsyn/tst/nskx/.February19,.sparc/sspitsyn.SunOS.sparc/redefineClassInBootstrap/redefineClassInBootstrap.err
[2013-02-20T02:08:21.02] EXECUTE_CLASS="${test_name}"
[2013-02-20T02:08:21.02] # Actual: EXECUTE_CLASS=redefineClassInBootstrap
[2013-02-20T02:08:21.02] EXECUTE_CLASS="vm.mlvm.indy.func.jvmti.share.IndyRedefineTest"
[2013-02-20T02:08:21.03] # Actual: EXECUTE_CLASS=vm.mlvm.indy.func.jvmti.share.IndyRedefineTest
[2013-02-20T02:08:21.03] TEST_ARGS="${TEST_ARGS} -dummyClassName=vm.mlvm.indy.func.jvmti.redefineClassInBootstrap.INDIFY_Dummy0 -popFrames true"
[2013-02-20T02:08:21.03] # Actual: TEST_ARGS=-dummyClassName=vm.mlvm.indy.func.jvmti.redefineClassInBootstrap.INDIFY_Dummy0 -popFrames true
[2013-02-20T02:08:21.03] LD_LIBRARY_PATH="${COMMON_LIBS_LOCATION}/lib/${ARCH}/vm/mlvm/indy/func/jvmti/share${SEPARATOR}${LD_LIBRARY_PATH}"
[2013-02-20T02:08:21.03] # Actual: LD_LIBRARY_PATH=/net/sc11152541/export/home/sspitsyn/utb7/vm/bin/lib/solaris-sparc/vm/mlvm/indy/func/jvmti/share:/net/sc11152541/export/home/sspitsyn/hs25/solaris-sparc/fastdebug/jre/lib/sparc/server
[2013-02-20T02:08:21.03] export LD_LIBRARY_PATH
[2013-02-20T02:08:21.03] JAVAC_OPTS="${JAVAC_OPTS} -g"
[2013-02-20T02:08:21.03] # Actual: JAVAC_OPTS=-g
[2013-02-20T02:08:21.03] AGENTS="-agentlib:IndyRedefineClass=verbose=~pathToNewByteCode=${COMMON_CLASSES_LOCATION}/newclass"
[2013-02-20T02:08:21.03] # Actual: AGENTS=-agentlib:IndyRedefineClass=verbose=~pathToNewByteCode=/net/sc11152541/export/home/sspitsyn/utb7/vm/bin/newclass
[2013-02-20T02:08:21.03] JAVA_OPTS="${JAVA_OPTS} ${AGENTS}"
[2013-02-20T02:08:21.04] # Actual: JAVA_OPTS=-server -verbose=1 -agentlib:IndyRedefineClass=verbose=~pathToNewByteCode=/net/sc11152541/export/home/sspitsyn/utb7/vm/bin/newclass
[2013-02-20T02:08:21.04] APPLICATION_TIMEOUT="${TIMEOUT}"
[2013-02-20T02:08:21.04] # Actual: APPLICATION_TIMEOUT=15
[2013-02-20T02:08:21.04] CLASSPATH="${test_work_dir}${PS}${CLASSPATH}"
[2013-02-20T02:08:21.04] # Actual: CLASSPATH=/net/sc11152596/export/home/sspitsyn/tst/nskx/.February19,.sparc/sspitsyn.SunOS.sparc/redefineClassInBootstrap:/net/sc11152541/export/home/sspitsyn/utb7/vm/bin/classes:/net/sc11152541/export/home/sspitsyn/hs25/solaris-sparc/fastdebug/lib/tools.jar
[2013-02-20T02:08:21.04] export CLASSPATH
[2013-02-20T02:08:21.04] ${JAVA} ${JAVA_OPTS} ${EXECUTE_CLASS} ${TEST_ARGS}
[2013-02-20T02:08:21.05] # Actual: /net/sc11152541/export/home/sspitsyn/hs25/solaris-sparc/fastdebug/bin/java -server -verbose=1 -agentlib:IndyRedefineClass=verbose=~pathToNewByteCode=/net/sc11152541/export/home/sspitsyn/utb7/vm/bin/newclass vm.mlvm.indy.func.jvmti.share.IndyRedefineTest -dummyClassName=vm.mlvm.indy.func.jvmti.redefineClassInBootstrap.INDIFY_Dummy0 -popFrames true
[2013-02-20T02:08:21.05] - IndyRedefineClass.c, 37: Setting redefined class name to vm/mlvm/indy/func/jvmti/redefineClassInBootstrap/INDIFY_Dummy0
[2013-02-20T02:08:25.57] - IndyRedefineClass.c, 31: Setting redefine trigger method name to redefineNow
[2013-02-20T02:08:25.57] - IndyRedefineClass.c, 109: Entering redefine tigger method: Lvm/mlvm/indy/func/jvmti/redefineClassInBootstrap/INDIFY_Dummy0;.redefineNow
[2013-02-20T02:08:25.57] - IndyRedefineClass.c, 117: Redefining class vm/mlvm/indy/func/jvmti/redefineClassInBootstrap/INDIFY_Dummy0
[2013-02-20T02:08:25.57] # info :: File = /net/sc11152541/export/home/sspitsyn/utb7/vm/bin/newclass/vm/mlvm/indy/func/jvmti/redefineClassInBootstrap/INDIFY_Dummy0.class 
[2013-02-20T02:08:25.57] #  info **Agent:: opening file /net/sc11152541/export/home/sspitsyn/utb7/vm/bin/newclass/vm/mlvm/indy/func/jvmti/redefineClassInBootstrap/INDIFY_Dummy0.class 
[2013-02-20T02:08:25.57] # info file size= 2860
[2013-02-20T02:08:25.57]  File red completely 
[2013-02-20T02:08:25.57] - IndyRedefineClass.c, 71: Enabling single step
[2013-02-20T02:08:25.57] - IndyRedefineClass.c, 80: Forcing early return
[2013-02-20T02:08:25.57] - IndyRedefineClass.c, 145: Single step event: Lvm/mlvm/indy/func/jvmti/redefineClassInBootstrap/INDIFY_Dummy0; .bootstrap :2e
[2013-02-20T02:08:25.67] - IndyRedefineClass.c, 71: Enabling single step
[2013-02-20T02:08:25.67] - IndyRedefineClass.c, 76: Popping a frame
[2013-02-20T02:08:25.67] - IndyRedefineClass.c, 145: Single step event: Ljava/lang/invoke/LambdaForm$DMH; .invokeStatic_LLL_L :e
[2013-02-20T02:08:25.67] - IndyRedefineClass.c, 65: Disabling single step
[2013-02-20T02:08:25.67] - IndyRedefineClass.c, 48: The following values should be non-zero for test to pass:
[2013-02-20T02:08:25.67] - IndyRedefineClass.c, 49: Method entry event fired? 1
[2013-02-20T02:08:25.67] - IndyRedefineClass.c, 50: Single step event fired? 1
[2013-02-20T02:08:25.67] - IndyRedefineClass.c, 51: The following value should be zero for test to pass:
[2013-02-20T02:08:25.67] - IndyRedefineClass.c, 52: Any other error occured? 0
[2013-02-20T02:08:25.67] ### TRACE 1: TEST PASSED
[2013-02-20T02:08:25.67] # Test level exit status: 95
Comments
Removed affects version hs25.6 (8u6). This fix is present in 8u6/hs25.6 so if these tests are failing it must be for a different reason and a new bug should be filed.
16-04-2014

http://aurora.ru.oracle.com/functional/faces/RunDetails.xhtml?names=460790.JAVASE_EMBEDDED_MASTER_NIGHTLY-23 RULE vm/mlvm/indy/func/jvmti/mergeCP_indy2none_a Exception java.lang.BootstrapMethodError: call site initialization exception
15-04-2014

Earlier bug filed by Tom Rodriguez.
17-03-2014

7u60-critical-request justification: This bug fix is better to be in the release because it is a part of the JSR-292 support in the JVMTI HotSwap API (includes RedefineClasses, RetransformClasses and PopFrame). This bug is one of 12 bug fixes that depend on each other and must be integrated in the order: https://jbs.oracle.com/bugs/browse/JDK-7194607 https://jbs.oracle.com/bugs/browse/JDK-8005128 https://jbs.oracle.com/bugs/browse/JDK-8006542 https://jbs.oracle.com/bugs/browse/JDK-8006546 https://jbs.oracle.com/bugs/browse/JDK-8006731 https://jbs.oracle.com/bugs/browse/JDK-8008511 https://jbs.oracle.com/bugs/browse/JDK-8007037 https://jbs.oracle.com/bugs/browse/JDK-8014288 https://jbs.oracle.com/bugs/browse/JDK-8013945 https://jbs.oracle.com/bugs/browse/JDK-8014052 https://jbs.oracle.com/bugs/browse/JDK-7187554 https://jbs.oracle.com/bugs/browse/JDK-8023004 All the fixes above have been already integrated into the JDK 8 and tested in the hotspot-rt nightly for several months. Risk: low The fixes touch the JVMTI HotSwap API that includes RedefineClasses, RetransformClasses and PopFrame. The risk is only to introduce regressions in this part of the JVMTI implementation. This impacts only the debugging and profiling tools that use the JVMTI HotSwap feature. There are very small chances for regressions to sneak into the class file constant pool processing and method handles implementation. Webrevs and reviewers: The 7u60 webrevs location is: http://javaweb.sfbay.sun.com/java/svc/ss45998/webrevs/2013/hotspot/7u_port/ The fixes above were already passed the review process before integration into JDK 8. The reviewers were: twisti, jrose, coleenp, dholmes, etc. The 7u60 edition of fixes must be reviewed at least by jrose and twisti. Level of effort: All fixes need a secondary review phase after rebase from jdk8 to 7u60 repository. Testing coverage: The folllowing test suites must be run to ensure correctness of the fixes: JTREG tests: com/sun/jdi, java/lang/instrument NSK tests: vm.mlvm.testlist, nsk.jvmti.testlist, nsk.jdi.testlist, nsk.jdwp.testlist Result of not integrating: The users will not be able to use HotSwap technology for debuging and profiling Java code that depends on the JSR-292 implementation. In that case the integration of these fixes will have to be requested/escalated in 7 updates by the tool vendors and/or customers.
10-01-2014

Added the label "noreg-hard". This would be a tricky test case to write, but there are also other issues with that. There are already VM-SQE tests covering this (listed above), but even those are not going to pass because there are more bugs to fix in this area. This is why I did not add the label "noreg-sqe".
13-05-2013

Sometimes VM crashes so adding RULE vm/mlvm/indy/func/jvmti/mergeCP_indy2manyDiff_a Crash any RULE vm/mlvm/indy/func/jvmti/mergeCP_indy2manyDiff_b Crash any RULE vm/mlvm/indy/func/jvmti/mergeCP_indy2manySame_a Crash any RULE vm/mlvm/indy/func/jvmti/mergeCP_indy2manySame_b Crash any RULE vm/mlvm/indy/func/jvmti/mergeCP_indy2none_a Crash any RULE vm/mlvm/indy/func/jvmti/mergeCP_indy2none_b Crash any RULE vm/mlvm/indy/func/jvmti/mergeCP_indy2same_a Crash any RULE vm/mlvm/indy/func/jvmti/mergeCP_indy2same_b Crash any RULE vm/mlvm/indy/func/jvmti/mergeCP_none2indy_a Crash any RULE vm/mlvm/indy/func/jvmti/mergeCP_none2indy_b Crash any
04-03-2013

Here are rules: RULE vm/mlvm/indy/func/jvmti/mergeCP_indy2manyDiff_a ExitCode any RULE vm/mlvm/indy/func/jvmti/mergeCP_indy2manyDiff_b ExitCode any RULE vm/mlvm/indy/func/jvmti/mergeCP_indy2manySame_a ExitCode any RULE vm/mlvm/indy/func/jvmti/mergeCP_indy2manySame_b ExitCode any RULE vm/mlvm/indy/func/jvmti/mergeCP_indy2none_a ExitCode any RULE vm/mlvm/indy/func/jvmti/mergeCP_indy2none_b ExitCode any RULE vm/mlvm/indy/func/jvmti/mergeCP_indy2same_a ExitCode any RULE vm/mlvm/indy/func/jvmti/mergeCP_indy2same_b ExitCode any RULE vm/mlvm/indy/func/jvmti/mergeCP_none2indy_a ExitCode any RULE vm/mlvm/indy/func/jvmti/mergeCP_none2indy_b ExitCode any RULE vm/mlvm/indy/func/jvmti/mergeCP_indy2manyDiff_a Exception any RULE vm/mlvm/indy/func/jvmti/mergeCP_indy2manyDiff_b Exception any RULE vm/mlvm/indy/func/jvmti/mergeCP_indy2manySame_a Exception any RULE vm/mlvm/indy/func/jvmti/mergeCP_indy2manySame_b Exception any RULE vm/mlvm/indy/func/jvmti/mergeCP_indy2none_a Exception any RULE vm/mlvm/indy/func/jvmti/mergeCP_indy2none_b Exception any RULE vm/mlvm/indy/func/jvmti/mergeCP_indy2same_a Exception any RULE vm/mlvm/indy/func/jvmti/mergeCP_indy2same_b Exception any RULE vm/mlvm/indy/func/jvmti/mergeCP_none2indy_a Exception any RULE vm/mlvm/indy/func/jvmti/mergeCP_none2indy_b Exception any
04-03-2013

This is the list of newly added tests that also fail because of this bug: vm/mlvm/indy/func/jvmti/mergeCP_indy2manyDiff_a vm/mlvm/indy/func/jvmti/mergeCP_indy2manyDiff_b vm/mlvm/indy/func/jvmti/mergeCP_indy2manySame_a vm/mlvm/indy/func/jvmti/mergeCP_indy2manySame_b vm/mlvm/indy/func/jvmti/mergeCP_indy2none_a vm/mlvm/indy/func/jvmti/mergeCP_indy2none_b vm/mlvm/indy/func/jvmti/mergeCP_indy2same_a vm/mlvm/indy/func/jvmti/mergeCP_indy2same_b vm/mlvm/indy/func/jvmti/mergeCP_none2indy_a vm/mlvm/indy/func/jvmti/mergeCP_none2indy_b The tests above may have more reasons to fail though. But other causes are currently shadowed by this bug and will need to be discovered and investigated after this one is fixed.
28-02-2013

The solution suggested by John Rose is to create a MemberName side table with refs to the methods. This side table will be used by VM compilers and also by RedefineClasses to update the methods refs. This is an API needed for RedefineClasses to update method refs in MemberName objects (or MemberName side table): void adjust_method_entries(Method** old_methods, Method** new_methods, int methods_length); The similar API's for updating cp_cache, vtable and itable have one more parameter: bool *trace_name_printed It would make sense to add this parameter as well to be consistent.
20-02-2013