Skip to content
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

timers: call destroy on interval error #20001

Closed

Conversation

apapirovski
Copy link
Member

@apapirovski apapirovski commented Apr 13, 2018

When an interval callback throws an error, the destroy hook is never called due to a faulty if condition.

This change can be backported unlike the semver-major one in the next PR which would bring us in line with the browsers (and the spec).

CI: https://ci.nodejs.org/job/node-test-pull-request/14244/

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

When an interval callback throws an error, the destroy
hook is never called due to a faulty if condition.
@apapirovski apapirovski added the timers Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout. label Apr 13, 2018
@apapirovski
Copy link
Member Author

/cc @mcollina @Fishrock123 @nodejs/timers

}

process.on('uncaughtException', common.mustCall((err) => {
assert(err.message, 'setInterval Error');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to miss .strictEqual.

const hooks = initHooks();
hooks.enable();

// install first timeout
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: please always use capital letters for the first character of a comment and use punctuation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was left over from another test for async hooks. It's not a very helpful comment to be honest. Removing.

@apapirovski
Copy link
Member Author

Updated. Another CI: https://ci.nodejs.org/job/node-test-pull-request/14248/

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Apr 13, 2018
@apapirovski apapirovski added this to the 10.0.0 milestone Apr 17, 2018
apapirovski added a commit that referenced this pull request Apr 17, 2018
When an interval callback throws an error, the destroy
hook is never called due to a faulty if condition.

PR-URL: #20001
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
@apapirovski
Copy link
Member Author

Landed in 4f2000f

@jasnell If this can get into v10.0.0 then great but it's not a must. (It is a small bug-fix tho.)

@apapirovski apapirovski deleted the patch-timers-interval-destroy branch April 17, 2018 14:06
jasnell pushed a commit that referenced this pull request Apr 17, 2018
When an interval callback throws an error, the destroy
hook is never called due to a faulty if condition.

PR-URL: #20001
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. timers Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants