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
{{ message }}
Repository navigation
Stack trace gets lost in Node.js 12.6.0 when rethrowing from uncaught exception handler #28550
Platform: Darwin Bastians-MBP 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64
Up to version 12.5.0, when rethrowing the error from an uncaughtException handler, the original stack trace would be preserved. In version 12.6.0, this is no longer the case. Instead, a stack trace with only one line is printed, showing the callsite where the error has been rethrown.
rethrow.js:
'use strict';
process.on('uncaughtException', err => {
throw err;
});
function throwUncaughtError() {
throw new Error('Boom');
}
throwUncaughtError();
Running the above in 12.5.0 and 12.6.0 shows the difference:
> nvm use 12.5.0 && node rethrow
Now using node v12.5.0 (npm v6.9.0)
/Users/bastian/instana/code/nodejs/packages/collector/test/uncaught/apps/rethrow.js:4
throw err;
^
Error: Boom
at throwUncaughtError (/Users/bastian/instana/code/nodejs/packages/collector/test/uncaught/apps/rethrow.js:8:9)
at Object.<anonymous> (/Users/bastian/instana/code/nodejs/packages/collector/test/uncaught/apps/rethrow.js:11:1)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:643:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:839:10)
at internal/main/run_main_module.js:17:11
> nvm use 12.6.0 && node rethrow
Now using node v12.6.0 (npm v6.9.0)
/Users/bastian/instana/code/nodejs/packages/collector/test/uncaught/apps/rethrow.js:4
throw err;
^
Error: Boom
>
Commits 0fd6524 and 5b92eb4 might be related to this change in behaviour.
changed the title [-]Stack gets lost in Node.js 12.6.0 when rethrowing from uncaught exception handler [/-][+]Stack trace gets lost in Node.js 12.6.0 when rethrowing from uncaught exception handler [/+]on Jul 5, 2019
Activity
[-]Stack gets lost in Node.js 12.6.0 when rethrowing from uncaught exception handler [/-][+]Stack trace gets lost in Node.js 12.6.0 when rethrowing from uncaught exception handler [/+]addaleax commentedon Jul 5, 2019
/cc @joyeecheung
src: allow fatal exceptions to be enhanced
src: allow fatal exceptions to be enhanced