-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
src: disconnect inspector before exiting out of fatal exception #29611
Conversation
So that coverage, .etc are properly written in case of a normal fatal exception.
1da18a1
to
83fc7ad
Compare
src/node_errors.cc
Outdated
@@ -978,6 +978,7 @@ void TriggerUncaughtException(Isolate* isolate, | |||
|
|||
// Now we are certain that the exception is fatal. | |||
ReportFatalException(env, error, message, EnhanceFatalException::kEnhance); | |||
WaitForInspectorDisconnect(env); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't leave this for other Exit()
calls in TriggerUncaughtException()
as those cases are more abnormal than this (e.g. the global uncaught exception handler throws itself, or the global hook is monkey-pached incorrectly) and I think it would unsafe to wait until the inspector shut down in those cases.
@@ -978,6 +978,9 @@ void TriggerUncaughtException(Isolate* isolate, | |||
|
|||
// Now we are certain that the exception is fatal. | |||
ReportFatalException(env, error, message, EnhanceFatalException::kEnhance); | |||
#if HAVE_INSPECTOR | |||
profiler::EndStartedProfilers(env); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh just realized we should call profiler::EndStartedProfilers
instead since the whole WaitForInspectorDisconnect
resets signals.
@@ -0,0 +1,7 @@ | |||
const a = 99; | |||
if (true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no point of adding else block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is in the test though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One little nit with regards to test name 😄
Thanks for digging into this, I thought it would be something obvious.
test/parallel/test-v8-coverage.js
Outdated
@@ -35,6 +35,24 @@ function nextdir() { | |||
assert.strictEqual(fixtureCoverage.functions[0].ranges[1].count, 0); | |||
} | |||
|
|||
// Outputs coverage when process.exit(1) exits process. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps, change to:
// Outputs coverage when error is thrown in first tick
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh thanks for catching my copy-past error :)
a85298b
to
07c3ae3
Compare
@joyeecheung This is ready to land in your opinion? |
@Trott yes |
So that coverage, .etc are properly written in case of a normal fatal exception. PR-URL: nodejs#29611 Fixes: nodejs#29570 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Ben Coe <bencoe@gmail.com>
Landed in b263423 |
So that coverage, .etc are properly written in case of a normal
fatal exception.
Fixes: #29570
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes