Skip to content
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

8294924: JvmtiExport::post_exception_throw() doesn't deal well with concurrent stack processing #11238

Closed
wants to merge 3 commits into from

Conversation

fisk
Copy link
Contributor

@fisk fisk commented Nov 18, 2022

There is a stack walk in JvmtiExport::post_exception_throw() that has safepoints in it. This trips up the stack watermark code. This patch adds a RAII object to JvmtiExport::post_exception_throw() that keeps the thread and its stack fully processed throughout the function.
Testing: tier1-7 of ZGC tests on linux x86_64 debug and manual testing of the test that failed.


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-8294924: JvmtiExport::post_exception_throw() doesn't deal well with concurrent stack processing

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 11238

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 18, 2022

👋 Welcome back eosterlund! 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 18, 2022

@fisk The following labels will be automatically applied to this pull request:

  • hotspot
  • serviceability

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

@openjdk openjdk bot added serviceability serviceability-dev@openjdk.org hotspot hotspot-dev@openjdk.org labels Nov 18, 2022
@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 21, 2022
@mlbridge
Copy link

mlbridge bot commented Nov 21, 2022

Webrevs

Copy link
Contributor

@pchilano pchilano 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! The issue can also be easily reproduced by running a simplified variation of test events/Exception/exception01/exception01.java plus forcing a GC safepoint in that method: pchilano@9e61eb0

Thanks,
Patricio

@openjdk
Copy link

openjdk bot commented Nov 21, 2022

@fisk 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:

8294924: JvmtiExport::post_exception_throw() doesn't deal well with concurrent stack processing

Reviewed-by: pchilanomate, sspitsyn, dholmes

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 321 new commits pushed to the master branch:

  • b52611b: 8295401: Error recovery in module-info.java could be improved
  • 9e80cf9: 8296390: Incremental build failed with a NPE
  • b3501fd: 8297600: Check current thread in selected JRT_LEAF methods
  • f05bfb1: 8297515: serialVersionUID fields are not annotated with @serial
  • 22f5d01: 8252584: HotSpot Style Guide should permit alignas
  • 8ffed34: 8297681: Unnecessary color conversion during 4BYTE_ABGR_PRE to INT_ARGB_PRE blit
  • abe532a: 8296924: C2: assert(is_valid_AArch64_address(dest.target())) failed: bad address
  • 5dcaf6c: 8297749: Remove duplicate space in the ProtocolException message being thrown from HttpURLConnection
  • c7a679f: 8297290: Use int indices to reference CDS archived primitive mirrors
  • 37f613b: 8297676: DataBuffer.TYPE_SHORT/TYPE_FLOAT/TYPE_DOUBLE are not placeholders
  • ... and 311 more: https://git.openjdk.org/jdk/compare/4a0093ccc4ec2880a789af3a50f30e44b686150e...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 openjdk bot added the ready Pull request is ready to be integrated label Nov 21, 2022
Copy link
Contributor

@sspitsyn sspitsyn left a comment

Choose a reason for hiding this comment

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

Thank you for fixing this!
Looks good.
Added a minor comment.
Thanks,
Serguei

@@ -1964,6 +1965,7 @@ void JvmtiExport::post_exception_throw(JavaThread *thread, Method* method, addre
HandleMark hm(thread);
methodHandle mh(thread, method);
Handle exception_handle(thread, exception);
KeepStackGCProcessedMark ksgcpm(thread);

Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: It'd be nice to place a small comment about why it is needed.

Copy link
Member

Choose a reason for hiding this comment

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

+1 I've never even heard of this thing let alone understand when I would need to use it.

@fisk
Copy link
Contributor Author

fisk commented Nov 28, 2022

Thanks for the reviews, @dholmes-ora, @pchilano and @sspitsyn! I added a comment as requested.

Copy link
Member

@dholmes-ora dholmes-ora 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 the added comment. I can approve this as-is but I think we have a significant problem here as it remains completely unclear when KeepStackGCProcessedMark is needed or how its omission would be detected. This seems extremely fragile.

@sspitsyn
Copy link
Contributor

Thank you for the update. I agree with David that it is not very clear when it is needed. Approving anyway.

@fisk
Copy link
Contributor Author

fisk commented Nov 30, 2022

Thank you for the reviews, @sspitsyn and @dholmes-ora!

@fisk
Copy link
Contributor Author

fisk commented Nov 30, 2022

/integrate

@openjdk
Copy link

openjdk bot commented Nov 30, 2022

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

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Nov 30, 2022

@fisk Pushed as commit be4245e.

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

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