JDK-8262002 : java/lang/instrument/VerifyLocalVariableTableOnRetransformTest.sh failed with "TestCaseScaffoldException: DummyClassWithLVT did not match .class file"
  • Type: Bug
  • Component: core-svc
  • Sub-Component: java.lang.instrument
  • Affected Version: 17
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: x86_64
  • Submitted: 2021-02-19
  • Updated: 2023-01-12
  • Resolved: 2021-05-06
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 17
17 b22Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
The following test failed in the JDK17 CI:

java/lang/instrument/VerifyLocalVariableTableOnRetransformTest.sh

Here's a snippet from the log file:

VerifyLocalVariableTableOnRetransformTest$MyObserver.transform() sees 'java/util/NavigableSet' of 1179 bytes.
VerifyLocalVariableTableOnRetransformTest$MyObserver.transform() sees 'java/util/IdentityHashMap' of 13111 bytes.
VerifyLocalVariableTableOnRetransformTest$MyObserver.transform() sees 'java/util/IdentityHashMap$KeySet' of 3688 bytes.
ATestCaseScaffold$TestCaseScaffoldException: DummyClassWithLVT did not match .class file
	at ATestCaseScaffold.fail(ATestCaseScaffold.java:116)
	at ATestCaseScaffold.assertTrue(ATestCaseScaffold.java:129)
	at VerifyLocalVariableTableOnRetransformTest.verifyClassFileBuffer(VerifyLocalVariableTableOnRetransformTest.java:123)
	at VerifyLocalVariableTableOnRetransformTest.doRunTest(VerifyLocalVariableTableOnRetransformTest.java:72)
	at ATestCaseScaffold.runTest(ATestCaseScaffold.java:60)
	at VerifyLocalVariableTableOnRetransformTest.main(VerifyLocalVariableTableOnRetransformTest.java:66)
VerifyLocalVariableTableOnRetransformTest$MyObserver.transform() sees 'java/lang/Shutdown' of 2722 bytes.
VerifyLocalVariableTableOnRetransformTest$MyObserver.transform() sees 'java/lang/Shutdown$Lock' of 360 bytes.
ATestCaseScaffold$TestCaseScaffoldException: DummyClassWithLVT did not match .class file
FAIL: found 'did not match .class file' in the test output
INFO: 'javap -v' comparison between the .class files:
1c1
< Classfile /opt/mach5/mesos/work_dir/slaves/a4f8fba9-f017-4328-b286-c66b6a97143d-S9021/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/ae50325a-a120-4da0-84a8-dec2fc9980d9/runs/89647b55-3da1-45c9-88a0-3170ea16b90f/testoutput/test-support/jtreg_open_test_jdk_jdk_svc/classes/2/java/lang/instrument/VerifyLocalVariableTableOnRetransformTest.d/DummyClassWithLVT.class
---
> Classfile /opt/mach5/mesos/work_dir/slaves/a4f8fba9-f017-4328-b286-c66b6a97143d-S9021/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/ae50325a-a120-4da0-84a8-dec2fc9980d9/runs/89647b55-3da1-45c9-88a0-3170ea16b90f/testoutput/test-support/jtreg_open_test_jdk_jdk_svc/scratch/3/DummyClassWithLVT.class
3c3
<   SHA-256 checksum ba26964074fb3f240e485f46be66aa3afc302a60c1807410b6cadc618f104328
---
>   SHA-256 checksum e8ecc277c488978c3230e8cc6d51d404c6952492252d02f701e801c784952395
216a217,218
> InnerClasses:
>   public static final #106= #102 of #104; // Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles
242,243d243
< InnerClasses:
<   public static final #106= #102 of #104; // Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles
----------System.err:(0/0)----------
----------rerun:(31/3685)*----------
Comments
Changeset: 52f1db6b Author: Alex Menkov <amenkov@openjdk.org> Date: 2021-05-06 18:34:12 +0000 URL: https://git.openjdk.java.net/jdk/commit/52f1db6b6f7f5e5823ee84fc31edddf89ed21df4
06-05-2021

JDK-8222289 changed javac output in jdk 13 - changed order innerClasses->bootstrapMethods to bootstrapMethods->innerClasses Looks like this change of order was unintentional, review thread does not mention this: https://mail.openjdk.java.net/pipermail/compiler-dev/2019-April/013205.html So we have 3 ways to handle the failure: 1. restore original order in javac; 2. update JvmtiClassFileReconstituter to be in sync with javac 3. update the test to handle the difference between javac output and retransformClasses class file bytes (the test verifies that LocalVariableTable is passed to class transformers)
06-04-2021

Updated test to avoid LinkageError (see JDK-8264667). "DummyClassWithLVT did not match .class file" error is not reproducible with jdk11, is reproducible with jdk13 (initial release)
02-04-2021

It's hard to say if the behavior was changes as looks like the test does not work as expected (and it's unknown how long). For successful run it actually throws an exception: InstrumentationHandoff JPLIS agent initialized Reading test class from T:\\testoutput\\test-support\\jtreg_open_test_jdk_jdk_instrument\\classes\\3\\java\\lang\\instrument\\VerifyLocalVariableTableOnRetransformTest.d\\DummyClassWithLVT.class Read 1664 bytes. VerifyLocalVariableTableOnRetransformTest$MyObserver.transform() sees 'java/lang/invoke/BoundMethodHandle$Species_LLLLL' of 3438 bytes. VerifyLocalVariableTableOnRetransformTest$MyObserver.transform() sees 'java/lang/invoke/BoundMethodHandle$Species_LLLLL' of 3438 bytes. Debugging message: tearDown beginning Exception in thread "main" VerifyLocalVariableTableOnRetransformTest$MyObserver.transform() sees 'java/lang/Throwable$WrappedPrintStream' of 829 bytes. VerifyLocalVariableTableOnRetransformTest$MyObserver.transform() sees 'java/lang/Throwable$PrintStreamOrWriter' of 489 bytes. VerifyLocalVariableTableOnRetransformTest$MyObserver.transform() sees 'java/util/IdentityHashMap' of 13111 bytes. VerifyLocalVariableTableOnRetransformTest$MyObserver.transform() sees 'java/util/IdentityHashMap$KeySet' of 3688 bytes. java.lang.LinkageError: loader 'bootstrap' attempted duplicate class definition for java.lang.invoke.BoundMethodHandle$Species_LLLLL. (java.lang.invoke.BoundMethodHandle$Species_LLLLL is in module java.base of loader 'bootstrap') VerifyLocalVariableTableOnRetransformTest$MyObserver.transform() sees 'java/lang/StackTraceElement$HashedModules' of 2352 bytes. at java.base/java.lang.ClassLoader.defineClass1(Native Method) at java.base/java.lang.System$2.defineClass(System.java:2192) at java.base/java.lang.invoke.ClassSpecializer$Factory.generateConcreteSpeciesCode(ClassSpecializer.java:586) at java.base/java.lang.invoke.ClassSpecializer$Factory.loadSpecies(ClassSpecializer.java:491) at java.base/java.lang.invoke.ClassSpecializer.findSpecies(ClassSpecializer.java:195) at java.base/java.lang.invoke.BoundMethodHandle$SpeciesData.extendWith(BoundMethodHandle.java:375) at java.base/java.lang.invoke.LambdaFormEditor.newSpeciesData(LambdaFormEditor.java:467) at java.base/java.lang.invoke.LambdaFormEditor.makeArgumentCombinationForm(LambdaFormEditor.java:890) at java.base/java.lang.invoke.LambdaFormEditor.filterArgumentsForm(LambdaFormEditor.java:1075) at java.base/java.lang.invoke.MethodHandles.argumentsWithCombiner(MethodHandles.java:6134) at java.base/java.lang.invoke.MethodHandles.filterArgumentsWithCombiner(MethodHandles.java:6099) at java.base/java.lang.invoke.StringConcatFactory.generateMHInlineCopy(StringConcatFactory.java:597) at java.base/java.lang.invoke.StringConcatFactory.makeConcatWithConstants(StringConcatFactory.java:358) at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:102) at java.base/java.lang.invoke.CallSite.makeSite(CallSite.java:315) at java.base/java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:281) at java.base/java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:271) at ATransformerManagementTestCase.addTransformerToManager(ATransformerManagementTestCase.java:121) at VerifyLocalVariableTableOnRetransformTest.verifyClassFileBuffer(VerifyLocalVariableTableOnRetransformTest.java:83) at VerifyLocalVariableTableOnRetransformTest.doRunTest(VerifyLocalVariableTableOnRetransformTest.java:72) at ATestCaseScaffold.runTest(ATestCaseScaffold.java:60) at VerifyLocalVariableTableOnRetransformTest.main(VerifyLocalVariableTableOnRetransformTest.java:66) VerifyLocalVariableTableOnRetransformTest$MyObserver.transform() sees 'java/lang/Shutdown' of 2722 bytes. VerifyLocalVariableTableOnRetransformTest$MyObserver.transform() sees 'java/lang/Shutdown$Lock' of 360 bytes. PASS: did NOT find 'did not match .class file' in the test output But shell script does not detect this.
23-03-2021

The test has a comment: // The HotSpot VM hands us class file bytes at initial class // load time that match the .class file contents. However, // according to the following spec that is not required: // http://docs.oracle.com/javase/7/docs/api/java/lang/instrument/Instrumentation.html#retransformClasses(java.lang.Class...) // This test exists to catch any unintentional change in // behavior by the HotSpot VM. If this behavior is intentionally // changed in the future, then this test will need to be // updated.
23-03-2021

javap reports the same content of the class bytes. The only difference is order of the data for compiled class javap reports BootstrapMethods and then InnerClasses, for data received file class transformer javap reports InnerClasses and then BootstrapMethods.
23-03-2021