RFR: 8344013: "bad tag in log" assert with +LogCompilation +CITimeVerbose

Sonia Zaldana Calles szaldana at openjdk.org
Fri Nov 22 19:31:35 UTC 2024


Hi folks, 

This PR addresses [8344013](https://bugs.openjdk.org/browse/JDK-8344013).

Sometimes the writing to xmlStream is mixed from several threads, and therefore the xmlStream tag stack can end up in a bad state. When this occurs, the VM crashes in `xmlStream::pop_tag` with `assert(false) failed: bad tag in log`. 

In this case, running `java -XX:+LogCompilation -XX:CompileCommand="log,*.*" -XX:+CITimeVerbose -Xcomp -Xbatch -version` , `xmlStream::pop_tag` is expecting to pop the tag `task` but finds `phase` instead. 

I found the issue stems from [8330157](https://bugs.openjdk.org/browse/JDK-8330157). The problematic code is in the destructor for [TracePhase](https://github.com/openjdk/jdk/blame/master/src/hotspot/share/opto/compile.cpp#L4337).

Note how the constructor adds the [phase tag](https://github.com/openjdk/jdk/blame/master/src/hotspot/share/opto/compile.cpp#L4327).

However, in the destructor, if we return early, we don’t pop that tag, leading to the xmlStream tag stack to end up in a bad state. With this patch, I made sure we pop the tag even if we return early. 

Cheers, 
Sonia

-------------

Commit messages:
 - 8344013: "bad tag in log" assert with +LogCompilation +CITimeVerbose

Changes: https://git.openjdk.org/jdk/pull/22331/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=22331&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8344013
  Stats: 3 lines in 1 file changed: 3 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/22331.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/22331/head:pull/22331

PR: https://git.openjdk.org/jdk/pull/22331


More information about the hotspot-compiler-dev mailing list