-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
async_hooks: check for empty contexts before removing
This way we don't end up attempting to SetPromiseHooks on contexts that have already been collected. Fixes: #39019 PR-URL: #39095 Reviewed-By: Stephen Belanger <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Andrey Pechkurov <[email protected]> Reviewed-By: Danielle Adams <[email protected]>
- Loading branch information
Showing
2 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Flags: --expose-gc | ||
'use strict'; | ||
|
||
require('../common'); | ||
const asyncHooks = require('async_hooks'); | ||
const vm = require('vm'); | ||
|
||
// This is a regression test for https://github.com/nodejs/node/issues/39019 | ||
// | ||
// It should not segfault. | ||
|
||
const hook = asyncHooks.createHook({ init() {} }).enable(); | ||
vm.createContext(); | ||
globalThis.gc(); | ||
hook.disable(); |