-
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
vm: fix nested timeouts with inverse order + fix flaky test-vm-timeout #7373
Conversation
@@ -835,15 +835,17 @@ class ContextifyScript : public BaseObject { | |||
Local<Script> script = unbound_script->BindToCurrentContext(); | |||
|
|||
Local<Value> result; | |||
bool timed_out = false; | |||
bool timed_out = false, received_signal = false; |
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.
IMHO it would look better to have these as separate declarations.
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.
Changed it to separate declarations
Green! The CI is green again! I'm reluctant to review C++ parts of Node.js (even though this looks pretty straightforward) and I'll leave that to people infinitely more familiar with Node.js's C++ pieces. But 💯 on having a fix for this! 🎉 🎈 ✨ |
If this is fixing the flaky test, there should be a commit that removes the flaky status too. |
93dc504
to
37ca1dd
Compare
Updated + added revert of #7359 |
} | ||
|
||
try_catch.ReThrow(); |
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.
Not a comment but an observation: it's not necessary to rethrow when calling ThrowError() (although it doesn't hurt either - ThrowException() silently updates the TryCatch exception) but it might be confusing to the casual reader what exactly gets rethrown.
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.
@bnoordhuis Not sure I’m completely understanding you – the ReThrow()
is necessary because otherwise the TryCatch
would catch the Script execution timed out/interrupted
errors.
But you’re right, it might be a good idea to explicitly state what exactly is thrown here, I’m adding a comment.
LGTM with two suggestions. |
37ca1dd
to
71d0dc7
Compare
Looks like you did them right to me. |
// It is possible that execution was terminated by another timeout in | ||
// which this timeout is nested, so check whether one of the watchdogs | ||
// from this invocation is responsible for termination. | ||
if (timed_out || received_signal) { |
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.
Could this just be an if - else if
instead of nested if
s?
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.
@cjihrig done, thanks
LGTM with one small comment. |
Likely fix the flaky parallel/test-vm-timeout. Increase the outer timeout in the test checking for nested timeouts with `vm` scripts so that its firing won’t interfere with the inner timeout. Fixes: nodejs#6727
When a vm script aborted after a timeout/signal interruption, test whether the local timeout/signal watchdog was responsible for terminating the execution. Without this, when a shorter timer from an outer `vm.run*` invocation fires before an inner timeout, the inner timeout would throw an error instead of the outer one, but because it did not witness the timeout itself, it would assume the termination was the result of a signal interruption.
This reverts commit f34caa9.
71d0dc7
to
ce5f4dc
Compare
One more CI: https://ci.nodejs.org/job/node-test-commit/3845/ |
Likely fix the flaky parallel/test-vm-timeout. Increase the outer timeout in the test checking for nested timeouts with `vm` scripts so that its firing won’t interfere with the inner timeout. Fixes: #6727 PR-URL: #7373 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
When a vm script aborted after a timeout/signal interruption, test whether the local timeout/signal watchdog was responsible for terminating the execution. Without this, when a shorter timer from an outer `vm.run*` invocation fires before an inner timeout, the inner timeout would throw an error instead of the outer one, but because it did not witness the timeout itself, it would assume the termination was the result of a signal interruption. PR-URL: #7373 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
This reverts commit f34caa9. PR-URL: #7373 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Likely fix the flaky parallel/test-vm-timeout. Increase the outer timeout in the test checking for nested timeouts with `vm` scripts so that its firing won’t interfere with the inner timeout. Fixes: #6727 PR-URL: #7373 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
When a vm script aborted after a timeout/signal interruption, test whether the local timeout/signal watchdog was responsible for terminating the execution. Without this, when a shorter timer from an outer `vm.run*` invocation fires before an inner timeout, the inner timeout would throw an error instead of the outer one, but because it did not witness the timeout itself, it would assume the termination was the result of a signal interruption. PR-URL: #7373 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
This reverts commit f34caa9. PR-URL: #7373 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Likely fix the flaky parallel/test-vm-timeout. Increase the outer timeout in the test checking for nested timeouts with `vm` scripts so that its firing won’t interfere with the inner timeout. Fixes: #6727 PR-URL: #7373 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
When a vm script aborted after a timeout/signal interruption, test whether the local timeout/signal watchdog was responsible for terminating the execution. Without this, when a shorter timer from an outer `vm.run*` invocation fires before an inner timeout, the inner timeout would throw an error instead of the outer one, but because it did not witness the timeout itself, it would assume the termination was the result of a signal interruption. PR-URL: #7373 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
This reverts commit f34caa9. PR-URL: #7373 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
@addaleax lts? |
@thealphanerd Yes, but only the |
sounds a bit convoluted... would you be able to send a backport PR? |
Likely fix the flaky parallel/test-vm-timeout. Increase the outer timeout in the test checking for nested timeouts with `vm` scripts so that its firing won’t interfere with the inner timeout. Fixes: nodejs#6727 PR-URL: nodejs#7373 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
This reverts commit f34caa9. PR-URL: nodejs#7373 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Likely fix the flaky parallel/test-vm-timeout. Increase the outer timeout in the test checking for nested timeouts with `vm` scripts so that its firing won’t interfere with the inner timeout. Fixes: #6727 PR-URL: #7373 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
This reverts commit f34caa9. PR-URL: #7373 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Likely fix the flaky parallel/test-vm-timeout. Increase the outer timeout in the test checking for nested timeouts with `vm` scripts so that its firing won’t interfere with the inner timeout. Fixes: #6727 PR-URL: #7373 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
This reverts commit f34caa9. PR-URL: #7373 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Likely fix the flaky parallel/test-vm-timeout. Increase the outer timeout in the test checking for nested timeouts with `vm` scripts so that its firing won’t interfere with the inner timeout. Fixes: #6727 PR-URL: #7373 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
This reverts commit f34caa9. PR-URL: #7373 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Likely fix the flaky parallel/test-vm-timeout. Increase the outer timeout in the test checking for nested timeouts with `vm` scripts so that its firing won’t interfere with the inner timeout. Fixes: #6727 PR-URL: #7373 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
This reverts commit f34caa9. PR-URL: #7373 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Checklist
make -j4 test
(UNIX) orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
vm, test
Description of change
Fix #6727:
test-vm-timeout
was flaky even before vm,repl: (add ability to) break on sigint/ctrl+c #6635 is that the outer timeout could interfere with handling of the inner timeout, e.g. during construction of theError
object that would be created. Increasing the outer timeout won’t have any adverse effects anyway./cc @bnoordhuis ?