forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
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: nodejs#39019
- Loading branch information
Showing
2 changed files
with
20 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(); |