You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a step into command is invoked on a method that is async function of an prototype, with closure scopes, the node crashes. Here is hypothetical code:
// module.jsmodule.exports=functionsomeClosure(){'use strict';constpath=require('path');// ... other const values defined in this closurefunctionClass(){}Class.prototype=Object.create(Object.prototype,{// Property definitions:method: {// Note: this occurred with non-configurable, non-writable function on the prototypeenumerable: true,value: asyncfunction(){/* some code returning promise */}}});returnClass;};
// index.jsconstClass=require('./module')();constinstance=newClass();// (1)Breakpoint on the next lineinstance.method(/* ... some parameters ... */).then(/* ... */);
When a breakpoint is set on the method call and "step into" command is issued, the inspector crashes. If no breakpoint is set on line (1), but a breakpoint is set within the method, inspector runs normally. Note that the crush occurs when "step into" command is issued. Breaking on the line of the call is not a problem. All function scopes and closures can be examined without causing a crash.
Running with the same version of nodejs, but with a debug build from source, the following output is obtained:
P.S. The bug occurs in the release version v13.6.0, as downloaded by nvm or even when using prebuilt linux-x64 node from NodeJS downloads. The debug output here is shown from debug build from source, but without non-optimized debug V8 (due to errors in GCC build of slow checks). Thus currently bt does not provide source information, while frame provides a source location, but no source files. Therefore, I cannot show better trace than this.
The text was updated successfully, but these errors were encountered:
v8/v8@fc17585 solves that (e.g. through using curl -L 'https://github.com/v8/v8/commit/fc1758579661a3831ab954a9b35aea61363187dc.patch' | git am --directory=deps/v8)
Update: It seems this issues is fixed on master now. Instead of crash, the step into now enters emitInitNative (probably called from C++). On step out of emitInitNative, the execution goes into the async function. As expected the call stack does not contain any other frames between the caller and the async callee. Going through step into - step out cycle for emitInitNative is a little bit annoying, but not as disruptive as crash during debugging.
For example a function defined as:
asyncfunctiontest(){ ... }
would have call stack after step-into, step-out, step-into (again) on a call statement test():
at test (/usr/src/test/test-async.js:5:18)
at Object.<anonymous> (/usr/src/test/test-async.js:10:1)
Therefore going through the emitInitNative does not affect stack frames;
After the first await, the stack becomes::
at test (/usr/src/test/test-async.js:6:18)
-- await in test (async) --
at Object.<anonymous> (/usr/src/test/test-async.js:10:1)
As the current version of the master is v14.0.0-pre I do not suppose this fix would make it in v13.x?
P.S. I do not see what fixed this. I suppose it is possible the fix came as V8 is not updated to 8.1.307.26-node.12 from 7.9.317.25-node.30.
If a
step into
command is invoked on a method that is async function of an prototype, with closure scopes, the node crashes. Here is hypothetical code:When a breakpoint is set on the method call and "step into" command is issued, the inspector crashes. If no breakpoint is set on line (1), but a breakpoint is set within the method, inspector runs normally. Note that the crush occurs when "step into" command is issued. Breaking on the line of the call is not a problem. All function scopes and closures can be examined without causing a crash.
Running with the same version of nodejs, but with a debug build from source, the following output is obtained:
Here is source information extracted for the most relevant frames:
P.S. The bug occurs in the release version
v13.6.0
, as downloaded bynvm
or even when using prebuiltlinux-x64
node from NodeJS downloads. The debug output here is shown from debug build from source, but without non-optimized debug V8 (due to errors in GCC build of slow checks). Thus currentlybt
does not provide source information, whileframe
provides a source location, but no source files. Therefore, I cannot show better trace than this.The text was updated successfully, but these errors were encountered: