-
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
- Loading branch information
Showing
2 changed files
with
21 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(); | ||
gc(); | ||
hook.disable(); |