Skip to content

Conversation

@pchilano
Copy link
Contributor

@pchilano pchilano commented Sep 19, 2025

Please review this small fix. When thawing in the fast path, the top frame could be a runtime stub due to preempting on monitorenter. In the changes for JDK-8336845 I missed this, leading to a crash when dereferencing the nullptr returned by f.cb()->as_nmethod_or_null() in ThawBase::remove_top_compiled_frame_from_chunk.

I was able to reproduce the failure locally and verified it is now fixed. I did run into a pre-existing crash with Jetty (filed JDK-8368099). I also run all tests in java/lang/Thread/virtual stressing this path, tests Fuzz.java and TestVirtualThreads.java, plus extra mach5 tier testing.

Thanks,
Patricio


Progress

  • Change must not contain extraneous whitespace

Issue

  • JDK-8368002: [lworld] Crash in ThawBase::remove_top_compiled_frame_from_chunk (Bug - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1603

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/valhalla/pull/1603.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 19, 2025

👋 Welcome back pchilanomate! A progress list of the required criteria for merging this PR into lworld 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 Sep 19, 2025

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

8368002: [lworld] Crash in ThawBase::remove_top_compiled_frame_from_chunk

Reviewed-by: coleenp

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 435 new commits pushed to the lworld branch:

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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@coleenp) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@pchilano pchilano marked this pull request as ready for review September 19, 2025 15:10
@openjdk openjdk bot added ready Pull request is ready to be integrated rfr Pull request is ready for review labels Sep 19, 2025
@mlbridge
Copy link

mlbridge bot commented Sep 19, 2025

Webrevs

}

int ThawBase::remove_scalarized_frames(StackChunkFrameStream<ChunkFrames::CompiledOnly>& f, stackChunkOop chunk, int &argsize) {
int ThawBase::remove_scalarized_frames(StackChunkFrameStream<ChunkFrames::CompiledOnly>& f, stackChunkOop chunk, int frames_size, int &argsize) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for explaining this change to me. I think this parameter is confusing. It's the incoming frame_size from the stub frame, and this adds in all the frame sizes from the frames that need a stack repair.
It might make more sense to me to distinguish these things, have the parameter be "stub_frame_size" or "top_frame_size" and to have a local to accumulate the visited frames sizes like:
int frames_size = stub_frame_size;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed that parameter altogether. I realized we can remove all the duplicated code in remove_scalarized_frames(), so that the method just returns the size of all the frames removed. Then for the stub case, we add this value to the size of the stub frame. For the non-stub case, this returned value is the final size.

}

int ThawBase::remove_scalarized_frames(StackChunkFrameStream<ChunkFrames::CompiledOnly>& f, stackChunkOop chunk, int &argsize) {
DEBUG_ONLY(intptr_t* const chunk_sp = chunk->start_address() + chunk->sp();)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you remove the 'chunk' parameter too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, also not needed. Removed.

Copy link
Contributor

@coleenp coleenp left a comment

Choose a reason for hiding this comment

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

This looks really good.

@pchilano
Copy link
Contributor Author

Thanks Coleen!
/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Sep 23, 2025
@openjdk
Copy link

openjdk bot commented Sep 23, 2025

@pchilano
Your change (at version 15b254f) is now ready to be sponsored by a Committer.

@coleenp
Copy link
Contributor

coleenp commented Sep 23, 2025

/sponsor

@openjdk
Copy link

openjdk bot commented Sep 23, 2025

Going to push as commit feee12a.
Since your change was applied there have been 436 commits pushed to the lworld branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Sep 23, 2025
@openjdk openjdk bot closed this Sep 23, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Sep 23, 2025
@openjdk
Copy link

openjdk bot commented Sep 23, 2025

@coleenp @pchilano Pushed as commit feee12a.

💡 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

integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

2 participants