Skip to content

Conversation

@rm-gh-8
Copy link
Contributor

@rm-gh-8 rm-gh-8 commented Jan 13, 2026

Backporting JDK-8372591: assert(!current->cont_fastpath() || freeze.check_valid_fast_path()) failed.

This PR fixes a critical bug in OSR (On-Stack Replacement) handling with continuations where _cont_fastpath is incorrectly set when an OSR frame has an interpreted caller. The issue occurs because OSR frames are created from the sender's unextended_sp (not sp), but _cont_fastpath was being set to the sender's sp, potentially pointing outside valid stack space.

This mismatch can cause _cont_fastpath to be prematurely cleared while interpreted frames remain on the stack, leading to incorrect execution of the freeze fast path (which should only run when all frames are compiled) and resulting in crashes.

The fix changes OSR_migration_begin to use the sender's unextended_sp for _cont_fastpath, ensuring proper stack boundary tracking.

This backport has internal demand.

Ran related tests on linux-x64, linux-aarch64, macos-aarch64 and windows-x64:

make test TEST=test/jdk/jdk/internal/vm

Results attached:

linux-aarch64-specific-test.log
linux-x64-specific-test.log
macos-aarch64-specific-test.log
windows-x64-specific-test.log


Progress

  • Change must not contain extraneous whitespace
  • JDK-8372591 needs maintainer approval
  • Commit message must refer to an issue

Issue

  • JDK-8372591: assert(!current->cont_fastpath() || freeze.check_valid_fast_path()) failed (Bug - P3 - Approved)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk25u-dev.git pull/144/head:pull/144
$ git checkout pull/144

Update a local copy of the PR:
$ git checkout pull/144
$ git pull https://git.openjdk.org/jdk25u-dev.git pull/144/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 144

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk25u-dev/pull/144.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 13, 2026

👋 Welcome back rm-gh-8! 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 Jan 13, 2026

@rm-gh-8 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:

8372591: assert(!current->cont_fastpath() || freeze.check_valid_fast_path()) failed

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 9 new commits pushed to the master 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.

➡️ 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).

@openjdk openjdk bot changed the title Backport 5fd095fb9b8f1d2000760519d42d7d0068b82651 8372591: assert(!current->cont_fastpath() || freeze.check_valid_fast_path()) failed Jan 13, 2026
@openjdk
Copy link

openjdk bot commented Jan 13, 2026

This backport pull request has now been updated with issue from the original commit.

@openjdk openjdk bot added backport Port of a pull request already in a different code base clean Identical backport; no merge resolution required labels Jan 13, 2026
@rm-gh-8 rm-gh-8 marked this pull request as ready for review January 13, 2026 21:59
@openjdk
Copy link

openjdk bot commented Jan 13, 2026

⚠️ @rm-gh-8 This change is now ready for you to apply for maintainer approval. This can be done directly in each associated issue or by using the /approval command.

@openjdk openjdk bot added the rfr Pull request is ready for review label Jan 13, 2026
@mlbridge
Copy link

mlbridge bot commented Jan 13, 2026

Webrevs

@rm-gh-8
Copy link
Contributor Author

rm-gh-8 commented Jan 14, 2026

/approval request for backport of JDK-8372591: assert(!current->cont_fastpath() || freeze.check_valid_fast_path()) failed.

This PR changes OSR_migration_begin to use the sender's unextended_sp for _cont_fastpath, ensuring proper stack boundary tracking.

This backport has internal demand.

High-medium risk - Incorrect stack pointer management could lead to memory corruption or crashes and changes to OSR handling might affect compilation performance or stack management overhead.

@openjdk
Copy link

openjdk bot commented Jan 14, 2026

@rm-gh-8
8372591: The approval request has been created successfully.

@openjdk openjdk bot added the approval Requires approval; will be removed when approval is received label Jan 14, 2026
@GoeLin
Copy link
Member

GoeLin commented Jan 14, 2026

Hi Roland,

if the backport only has internal demand, just bring it to your internal VM.
Please give a reason why this is important for OpenJDK.

@rm-gh-8
Copy link
Contributor Author

rm-gh-8 commented Jan 14, 2026

Hi Goetz,

Our customers utilize the JDK in a highly varied amount of use cases and issues that occur indicate that it may likely manifest for OpenJDK users, and would be a worthwhile consideration.

@openjdk openjdk bot added ready Pull request is ready to be integrated and removed approval Requires approval; will be removed when approval is received labels Jan 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Port of a pull request already in a different code base clean Identical backport; no merge resolution required ready Pull request is ready to be integrated rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

2 participants