-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Maximum call stack size exceeded" causes a crash in "async_hooks" module #37989
Comments
The following js code can also trigger "Maximum call stack size exceeded":
|
Well, there is a |
I'm not sure what you mean but the node instance still exits (abnormally) although there has been a RangeError thrown. I don't know if this is a normal behavior. |
|
Let me try to chip in on this, You can try to run this in let codeA = `function debug2(...args){fs.writeFileSync(1, \`\${util.format(...args)}\n\`, { flag: 'a' });}async_hooks.createHook({init(asyncId, type, triggerAsyncId, resource) {debug2('init: ',resource);},after(asyncId) {debug2(asyncId);new async_hooks.AsyncResource('str').bind(() => {});},}).enable();`;
eval(codeA) Which is actually just a very simple function function debug2(...args) {
fs.writeFileSync(1, `${util.format(...args)}\n`, { flag: 'a' });
}
async_hooks
.createHook({
init(asyncId, type, triggerAsyncId, resource) {
debug2('init: ', resource);
},
after(asyncId) {
debug2(asyncId);
new async_hooks.AsyncResource('str').bind(() => {});
},
})
.enable(); This would produce (a snippet of it since it keeps repeating) init: <ref *1> Timeout {
_idleTimeout: 15,
_idlePrev: [Circular *1],
_idleNext: [Circular *1],
_idleStart: null,
_onTimeout: [Function: flushHistory],
_timerArgs: undefined,
_repeat: null,
_destroyed: false,
[Symbol(refed)]: true,
[Symbol(kHasPrimitive)]: false,
[Symbol(asyncId)]: 73,
[Symbol(triggerId)]: 5
}
init: {
callback: [Function: maybeReadMore_],
args: [
ReadStream {
connecting: false,
_hadError: false,
_parent: null,
_host: null,
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 4,
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
init: {aw: true,
callback: [Function: afterWriteTick],
args: [ 0,
{ [Symbol(async_id_symbol)]: 5,
count: 1,Handle)]: [TTY],
cb: [Function: nop],]: false,
stream: [WriteStream],Size)]: 0,
state: [WritableState]l,
} [Symbol(kBuffer)]: null, I presumed the REPL is ran with some Any reason why you would want to do this in REPL? |
What steps will reproduce the bug?
Setup a node instance,
and run the following javascript code.
Then the node instance crashes.
How often does it reproduce? Is there a required condition?
This abort can always be triggered following the steps above.
What is the expected behavior?
If any error occurs, an exception or other similar error-reporting stuff should be thrown. There is no reason to abort the whole node process.
What do you see instead?
Additional information
The text was updated successfully, but these errors were encountered: