V5.15.1 proposal#358
Merged
Merged
Conversation
Co-authored-by: gh-worker-campaigns-3e9aa4[bot] <244854796+gh-worker-campaigns-3e9aa4[bot]@users.noreply.github.com>
Overall package sizeSelf size: 2.19 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | pprof-format | 2.2.2 | 500.53 kB | 500.53 kB | | source-map | 0.7.6 | 185.63 kB | 185.63 kB | | node-gyp-build | 4.8.4 | 13.86 kB | 13.86 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
This comment has been minimized.
This comment has been minimized.
szegedi
previously approved these changes
Jun 26, 2026
szegedi
approved these changes
Jun 26, 2026
WallProfiler registers an environment cleanup hook (CleanupHook) via node::AddEnvironmentCleanupHook so it can stop profiling when a worker isolate is terminated without a beforeExit notification. On termination, CleanupHook -> Cleanup -> Dispose called node::RemoveEnvironmentCleanupHook for that same hook. Node's cleanup-hook trampoline (CleanupHookThunkRun) invokes the hook and then dereferences its internal hook record again to remove the hook itself. Removing the hook from within the hook frees that record early, so when our callback returns Node reads freed memory — a use-after-free that segfaults on worker termination (observed reliably on Node 26, exercised by the "should not crash when worker is terminated" test). Add a removeCleanupHook flag to Dispose (default true). Cleanup, which only runs from inside CleanupHook, passes false and lets Node remove the hook itself. The still-running call sites (StopCore, StartImpl failure) keep removing it, since there the hook is live and must not fire later against a destroyed profiler. Reproduced and verified fixed in an Alpine/musl Node 26 container under gdb: crashed within 1-2 runs before, 30/30 clean after. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
4091a31 to
1f2e277
Compare
szegedi
approved these changes
Jun 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Improvements
Bug fixes