Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

Conversation

SoniaZaldana
Copy link
Member

@SoniaZaldana SoniaZaldana commented Nov 22, 2024

Hi folks,

This PR addresses 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. The problematic code is in the destructor for TracePhase.

Note how the constructor adds the phase tag.

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


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8344013: "bad tag in log" assert with +LogCompilation +CITimeVerbose (Bug - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/22331/head:pull/22331
$ git checkout pull/22331

Update a local copy of the PR:
$ git checkout pull/22331
$ git pull https://git.openjdk.org/jdk.git pull/22331/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 22331

View PR using the GUI difftool:
$ git pr show -t 22331

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/22331.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 22, 2024

👋 Welcome back szaldana! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Nov 22, 2024

@SoniaZaldana This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

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

Reviewed-by: chagedorn, dfenacci

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 59 new commits pushed to the master branch:

  • 6da3ecd: 8344960: RISC-V: fix TestFloatConversionsVectorNaN for COH and AlignVector
  • 9291abc: 8342074: Fix runtime/Thread/TestAlwaysPreTouchStacks.java to be flagless or accept VM flags
  • 0054bbe: 8343756: CAN_SHOW_REGISTERS_ON_ASSERT for Windows
  • 3a625f3: 8344628: Test TestEnableJVMCIProduct.java run with virtual thread intermittent fails
  • 25dd51e: 8344222: Remove calls to SecurityManager and doPrivileged in java.net.HttpURLConnection, java.net.HttpConnectSocketImpl, and javax.net.HttpsURLConnection after JEP 486 integration
  • 9793e73: 8344853: Parallel: Improve comments in psParallelCompact
  • 57d35f9: 8344382: RISC-V: CASandCAEwithNegExpected fails with Zacas
  • 0105203: 8337660: C2: basic blocks with only BoxLock nodes are wrongly treated as empty
  • 4e68d66: 8344954: Linker tests fails on BE platforms after JDK-8340205
  • ca81ab5: 8344994: Remove most uses of RuntimePermission checks in java.desktop
  • ... and 49 more: https://git.openjdk.org/jdk/compare/13987b4244614d594dc8f94c288eddb6239a066f...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk
Copy link

openjdk bot commented Nov 22, 2024

@SoniaZaldana The following label will be automatically applied to this pull request:

  • hotspot-compiler

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the hotspot-compiler hotspot-compiler-dev@openjdk.org label Nov 22, 2024
@SoniaZaldana SoniaZaldana marked this pull request as ready for review November 22, 2024 19:26
@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 22, 2024
@mlbridge
Copy link

mlbridge bot commented Nov 22, 2024

Webrevs

Copy link
Member

@chhagedorn chhagedorn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Can you also add a regression test for it? Since this already triggers with --version, you can just create a hello world like test and run with the mentioned flags.

Just a side note:

Note how the constructor adds the phase tag.

You can directly insert the permalink (in the non-blame view) such that the code is inlined in the PR for easier reading :-)

_log->begin_head("phase name='%s' nodes='%d' live='%d'", phase_name(), _compile->unique(), _compile->live_nodes());

Copy link
Contributor

@dafedafe dafedafe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me (C1 seems to already have this check). Thanks for fixing this.

@SoniaZaldana
Copy link
Member Author

Thanks for the reviews @chhagedorn @dafedafe! I added a regression test.

Copy link
Member

@chhagedorn chhagedorn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the test! Two minor comments, otherwise, looks good.

* @bug 8344013
* @requires vm.debug == true & vm.compiler2.enabled
* @summary Verify the xmlStream log stack is not left in a bad state
* @library /test/lib /
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not required and can be removed.

Suggested change
* @library /test/lib /

* @requires vm.debug == true & vm.compiler2.enabled
* @summary Verify the xmlStream log stack is not left in a bad state
* @library /test/lib /
* @run main/othervm -XX:+LogCompilation -XX:CompileCommand=log,*.* -XX:+CITimeVerbose -Xcomp -Xbatch compiler.debug.TestLogStackAssert
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-Xbatch is implied by -Xcomp.

Suggested change
* @run main/othervm -XX:+LogCompilation -XX:CompileCommand=log,*.* -XX:+CITimeVerbose -Xcomp -Xbatch compiler.debug.TestLogStackAssert
* @run main/othervm -XX:+LogCompilation -XX:CompileCommand=log,*.* -XX:+CITimeVerbose -Xcomp compiler.debug.TestLogStackAssert

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Nov 25, 2024
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Nov 25, 2024
@openjdk openjdk bot added the ready Pull request is ready to be integrated label Nov 26, 2024
@SoniaZaldana
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Nov 26, 2024

Going to push as commit 3689f39.
Since your change was applied there have been 71 commits pushed to the master branch:

  • 9458a43: 8318416: Superscript marks should use consistent font style
  • c5de307: 8344992: Remove Security Manager dependencies from java.security.cert API and implementations
  • 65c98e5: 8344420: Remove Security Manager dependencies from javax.security package
  • 2465526: 8344821: Test CheckDefaultArchiveFile.java fails if classes_coh.jsa is not present
  • d752f19: 8343427: Class file load hook crashes on archived classes from multi-release JARs
  • f1b5a6e: 8344565: SM cleanup in jdk/internal and java/lang package private classes
  • d8a2337: 8344895: SM cleanup of module java.xml
  • c329f97: 8345015: Remove unused method lookup_time_t_function
  • 86d527f: 8344949: javax.security.auth.Subject.SecureSet.writeObject does not do a security check anymore
  • f0b72f7: 8342380: Implement JEP 498: Warn upon Use of Memory-Access Methods in sun.misc.Unsafe
  • ... and 61 more: https://git.openjdk.org/jdk/compare/13987b4244614d594dc8f94c288eddb6239a066f...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Nov 26, 2024
@openjdk openjdk bot closed this Nov 26, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Nov 26, 2024
@openjdk
Copy link

openjdk bot commented Nov 26, 2024

@SoniaZaldana Pushed as commit 3689f39.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@tstuefe
Copy link
Member

tstuefe commented Dec 12, 2024

Very good. Thank you for fixing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-compiler hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

4 participants