Skip to content

fix(core): prevent stack overflow with snapshot enabled #15526

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

revam
Copy link

@revam revam commented Aug 11, 2025

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

With snapshot enabled it will use the deterministic UUID generator which in turn will keep track of a registry of currently in use UUIDs. They way it was doing the search for the next available UUID for the input key involved calling itself over and over until it found an available key, which could lead to a stack-overflow.

Issue Number: N/A

What is the new behavior?

The most lazy fix I could think of to prevent the stack overflow during search for the next id was switching the self-recursion out with a while loop. It will not help with the ever-increasing registry size and slowness with snapshot enabled in the application until you grab the next snapshot, but it will prevent the stack overflow as the search won't go as deep as before.

Feel free to fix it another way if you're dissatisfied with this band-aid. Just wanted to highlight the issue.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

The most lazy fix I could think of to prevent the stack overflow during search for the next id. It will not help with the ever-increasing registry size and slowness with snapshot enabled in the application until you grab the next snapshot, but it will prevent the stack overflow if the search goes too deep.

Feel free to fix it another way if you're dissatisfied with this band-aid. Just wanted to highlight the issue.
@coveralls
Copy link

Pull Request Test Coverage Report for Build 5701a038-06d9-4ede-b2c1-e14b62c40556

Details

  • 3 of 4 (75.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.002%) to 88.736%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/core/inspector/deterministic-uuid-registry.ts 3 4 75.0%
Totals Coverage Status
Change from base Build dd6f1ede-44c2-4f19-806c-d99b5c3ba328: 0.002%
Covered Lines: 7271
Relevant Lines: 8194

💛 - Coveralls

@kamilmysliwiec
Copy link
Member

Could you please provide a minimum reproduction repository (Git repository/StackBlitz/CodeSandbox project)?

@revam
Copy link
Author

revam commented Aug 12, 2025

I'll see if I can find time to make one by the end of this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants