JDK-8277301 : ciReplay: tag mismatch: wrong class files?
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 18
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2021-11-16
  • Updated: 2022-01-28
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 19
19Unresolved
Related Reports
Relates :  
Relates :  
Relates :  
Description
ReplayCompile could fail with following errors when parsing replay_pid files:
 1 - Failed on hidden class with comment expected
 2 - Failed on line not properly terminated
 3 - Failed on tag mismatch: wrong class files?
 4 - Failed on unknown command
     
In case of error 4 the unknown command is "anceKlass". Looks like 'instanceKlass' command was cut of for some reason. Could it be because of JDK-8276965? 


To reproduce above issues run java/lang/String/CompactString/CharAt.java and java/lang/String/CompactString/CompareTo.java tests without any VM flags just to get these tests compiled:
> $JT_HOME/bin/jtreg -jdk:$TESTED_JDK -retain:all open/test/jdk/java/lang/String/CompactString/CharAt.java
  $JT_HOME/bin/jtreg -jdk:$TESTED_JDK -retain:all open/test/jdk/java/lang/String/CompactString/CompareTo.java


Then set classpath like:
> CLASSPATH="JTwork/classes/java/lang/String/CompactString/CharAt.d:JTwork/classes/java/lang/String/CompactString/CompareTo.d:$JT_HOME/lib/testng.jar:$JT_HOME/lib/jcommander.jar:$JT_HOME/lib/guice.jar:$JT_HOME/lib/javatest.jar:$JT_HOME/lib/jtreg.jar"

And then run replay files one by one
> $TESTED_JDK/bin/java -cp $CLASSPATH  -XX:+ReplayCompiles -XX:ReplayDataFile=replay_bug_[N].log

Note, replay_bug_N.log file is used to reproduce issue N.
Comments
I believe the only remaining issue out of the 4 is this one: 3 - Failed on tag mismatch: wrong class files? so I'm updating the synopsis.
28-01-2022

"Failed on hidden class with comment expected" is due to printing in ciEnv::dump_replay_data_helper that doesn't append comment for hidden classes. I filed a new bug: JDK-8277423
18-11-2021

Dean [~dlong], to reproduce "Failed on hidden class with comment expected" do for example: - Copy open/test/jdk/java/lang/Math/MultiplicationTests.java to some local dir - Apply the following changes so you don't depend on any libraries: 36c36 < import jdk.test.lib.RandomFactory; --- > import java.util.Random; 45c45 < private static java.util.Random rnd = RandomFactory.getRandom(); --- > private static java.util.Random rnd = new Random(0); - compile $TESTED_JDK/bin/javac MultiplicationTests.java - run $TESTED_JDK/bin/java -XX:ReplaySuppressInitializers=0 -XX:+ReplayCompiles -XX:ReplayDataFile=replay_bug8277301_01b.log To generate the bad replay file do: > $TESTED_JDK/bin/java -XX:ReplaySuppressInitializers=0 -Xbatch -XX:CICrashAt=39 MultiplicationTests In case -XX:CICrashAt=39 doesn't lead to bad replay file run: > java -XX:ReplaySuppressInitializers=0 -XX:CompileCommand=option,*::*,DumpReplay -Xbatch MultiplicationTests and see when bad replay file is generated.
18-11-2021

For the tag mismatch error, see this comment: https://bugs.openjdk.java.net/browse/JDK-8276969?focusedCommentId=14458975&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14458975 It may be the same problem as JDK-8012384. I was hoping the "hidden class with comment expected" error was caused by JDK-8277316. The problem must be when the replay file is written, so just having the bad replay file is not enough. [~epavlova] I need a way to reproduce the problem in gdb to make progress.
18-11-2021

.jtr files generated by jtreg has rerun blocks which by mistake have VM flags added to javac but not to java command. As result -XX:ReplaySuppressInitializers=0 was not used when rerunning tests. -XX:ReplaySuppressInitializers=0 is needed to workaround existing ciReplay issues. I did rerun testing with proper flags and the failures 2 - Failed on line not properly terminated 4 - Failed on unknown command are not seen anymore. The failures 1 - Failed on hidden class with comment expected 3 - Failed on tag mismatch: wrong class files? are still seen.
18-11-2021

[~dlong], only failure " 4 - Failed on unknown command" seems went away. All other failures are still seen. I will update replay files to reproduce the issues.
18-11-2021

[~epavlova], do any of these failures still reproduce with the latest fixes?
18-11-2021

I filed a new bug for failure 4: JDK-8277316
17-11-2021

[~dlong], to reproduce replay_bug_01.log failure use for example open/test/jdk/java/lang/Math/MultiplicationTests.java - First run it using jtreg just to get all required files compiled - Then modify paths in following script and run it ======= TESTED_JDK=<path to tested jdk> JT_HOME=<path to jtreg> CP="JTwork/classes/java/lang/Math/MultiplicationTests.d:JTwork/classes/test/lib:${JT_HOME}/lib/jtreg.jar" ${TESTED_JDK}/bin/java \ -classpath $CP -XX:CompileCommand=option,*::*,DumpReplay -XX:ReplaySuppressInitializers=0 MultiplicationTests for i in `ls replay_pid*` do echo $i ${TESTED_JDK}/bin/java -classpath $CP -XX:ReplaySuppressInitializers=0 -XX:+ReplayCompiles -XX:ReplayDataFile=$i echo done =======
17-11-2021

ILW = various uncommon replay failures = MMH = P3
17-11-2021

[~epavlova] I need more details on the replay_bug_03.log failure. When I run it, I get a mismatch on a testng class, which probably means my jtreg version is different from yours.
17-11-2021

The replay_bug_02.log failure is because replay isn't actually resolving the MethodHandle in the constant pool. I filed a new bug: JDK-8277310.
17-11-2021

[~dlong], interesting. Basically the test is just run with -XX:CompileCommand=option,*::*,DumpReplay . jdk/java/lang/String/CompactString/* are testng tests. May be there is something related to testng which causes some concurrency issue, I will look. I will also try to see if these issues are seen in non testng tests.
17-11-2021

replay_bug_01.log doesn't have a comment after the hidden class on line 6 replay_bug_04.log has 2 compile lines. It looks like a replay file was written on top of an existing replay file, but not truncated. [~epavlova], what are the steps to create these corrupted replay files?
16-11-2021