Conversation
* Fix profiler shutdown when isolate is terminated When an isolate is terminated abruptly (eg. by Worker.terminate()), the profiler is not stopped and not removed from the isolate->profiler map. This can lead to a crash. This commit adds a cleanup hook with `node::AddEnvironmentCleanupHook` that is called when the isolate is destroyed. The cleanup hook stops the profiler and removes it from the profiler map.
Comment on lines
+16
to
+44
| it('should not crash when worker is terminated', async function () { | ||
| this.timeout(30000); | ||
| const nruns = 5; | ||
| const concurrentWorkers = 20; | ||
| for (let i = 0; i < nruns; i++) { | ||
| const workers = []; | ||
| for (let j = 0; j < concurrentWorkers; j++) { | ||
| const worker = new Worker('./out/test/worker2.js'); | ||
| worker.postMessage('hello'); | ||
|
|
||
| worker.on('message', () => { | ||
| worker.terminate(); | ||
| }); | ||
|
|
||
| workers.push( | ||
| new Promise<void>((resolve, reject) => { | ||
| worker.on('exit', exitCode => { | ||
| if (exitCode === 1) { | ||
| resolve(); | ||
| } else { | ||
| reject(new Error('Worker exited with code 0')); | ||
| } | ||
| }); | ||
| }) | ||
| ); | ||
| } | ||
| await Promise.all(workers); | ||
| } | ||
| }); |
There was a problem hiding this comment.
Overall package sizeSelf size: 1.58 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | source-map | 0.7.4 | 226 kB | 226 kB | | pprof-format | 2.1.0 | 111.69 kB | 111.69 kB | | p-limit | 3.1.0 | 7.75 kB | 13.78 kB | | delay | 5.0.0 | 11.17 kB | 11.17 kB | | node-gyp-build | 3.9.0 | 8.81 kB | 8.81 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
Bumps [serialize-javascript](https://github.com/yahoo/serialize-javascript) to 6.0.2 and updates ancestor dependency [mocha](https://github.com/mochajs/mocha). These dependencies need to be updated together. Updates `serialize-javascript` from 6.0.0 to 6.0.2 - [Release notes](https://github.com/yahoo/serialize-javascript/releases) - [Commits](yahoo/serialize-javascript@v6.0.0...v6.0.2) Updates `mocha` from 10.2.0 to 10.8.2 - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/main/CHANGELOG.md) - [Commits](mochajs/mocha@v10.2.0...v10.8.2) --- updated-dependencies: - dependency-name: serialize-javascript dependency-type: indirect - dependency-name: mocha dependency-type: direct:development ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
BenchmarksBenchmark execution time: 2025-06-10 11:05:51 Comparing candidate commit 992bcdf in PR branch Found 2 performance improvements and 0 performance regressions! Performance is the same for 92 metrics, 26 unstable metrics. scenario:profiler-light-load-no-wall-profiler-18
scenario:profiler-light-load-with-wall-profiler-18
|
nsavoire
approved these changes
Jun 10, 2025
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.
NOTE: this version could not be released, so it is superseded by 5.8.2 in #220