Skip to content

8380011: Path-to-gcroots search should not trigger stack overflows#4306

Open
tstuefe wants to merge 1 commit intoopenjdk:masterfrom
tstuefe:backport-tstuefe-347aae64-master
Open

8380011: Path-to-gcroots search should not trigger stack overflows#4306
tstuefe wants to merge 1 commit intoopenjdk:masterfrom
tstuefe:backport-tstuefe-347aae64-master

Conversation

@tstuefe
Copy link
Copy Markdown
Member

@tstuefe tstuefe commented Mar 20, 2026

This backports a fix to JFR path-to-roots-heap-search using DFS that would lead to crashes if object graphs are too deep and we run out of stack. The fix is very simple and low-risk.

I had to manually resolve (even though Skara applied the clean label? What gives?) due to

https://bugs.openjdk.org/browse/JDK-8283710 (JVMTI: Use BitSet for object marking)

but the change was trivial, and my code not affected by missing 8283710.


Progress

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

Issue

  • JDK-8380011: Path-to-gcroots search should not trigger stack overflows (Bug - P3 - Requested)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 4306

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link
Copy Markdown

bridgekeeper bot commented Mar 20, 2026

👋 Welcome back stuefe! 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
Copy Markdown

openjdk bot commented Mar 20, 2026

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot changed the title Backport 347aae6428358e79a9463b04654f3eaf83450595 8380011: Path-to-gcroots search should not trigger stack overflows Mar 20, 2026
@openjdk
Copy link
Copy Markdown

openjdk bot commented Mar 20, 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 Mar 20, 2026
@tstuefe tstuefe marked this pull request as ready for review March 20, 2026 08:02
@openjdk
Copy link
Copy Markdown

openjdk bot commented Mar 20, 2026

⚠️ @tstuefe 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 Mar 20, 2026
@tstuefe
Copy link
Copy Markdown
Member Author

tstuefe commented Mar 20, 2026

/approval request This fixes a crash in JFR when DFS object graph search gets too deep. Patch is small and low-risk. Tested: GHAs, and ran the contained regression test on Linux x64 manually.

@openjdk
Copy link
Copy Markdown

openjdk bot commented Mar 20, 2026

@tstuefe
8380011: The approval request has been created successfully.

@openjdk openjdk bot added the approval Requires approval; will be removed when approval is received label Mar 20, 2026
@mlbridge
Copy link
Copy Markdown

mlbridge bot commented Mar 20, 2026

Webrevs

Copy link
Copy Markdown
Member

@gnu-andrew gnu-andrew left a comment

Choose a reason for hiding this comment

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

Patch is near-clean, just thrown off by the slightly different types in the DFSClosure constructor signature. Testing looks good and risk seems low, just adding a space check to avoid overflow.

@gnu-andrew
Copy link
Copy Markdown
Member

I think the clean label does more than simply trying to apply the patch and includes some fuzzing; see https://github.com/openjdk/skara/blob/master/vcs/src/main/java/org/openjdk/skara/vcs/DiffComparator.java It's another reason I'm not a fan of allowing it to be used to skip review.

@tstuefe
Copy link
Copy Markdown
Member Author

tstuefe commented Mar 25, 2026

Thank you @gnu-andrew !

/integrate

@openjdk
Copy link
Copy Markdown

openjdk bot commented Mar 25, 2026

@tstuefe This pull request has not yet been marked as ready for integration.

@tstuefe
Copy link
Copy Markdown
Member Author

tstuefe commented Mar 28, 2026

@GoeLin Would you mind approving this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval Requires approval; will be removed when approval is received backport Port of a pull request already in a different code base clean Identical backport; no merge resolution required rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

2 participants