| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Sorry, something went wrong.
|
You should run make test to check for regressions and add a test. /cc @mscdex |
Sorry, something went wrong.
There was a problem hiding this comment.
This doesn't seem correct. We should definitely always skip to the next here if there is no callback (_onImmediate).
Would it work if you moved https://github.com/nodejs/node/pull/9759/files#diff-0a5d4868b2b9b17cf9e2c11f1bd1311eR594 above this?
Sorry, something went wrong.
There was a problem hiding this comment.
Not sure, but I think that would only protect against the very next immediate being cleared in the callback, and not anything else after the next one in the queue and we'd be back in an infinite loop? I'll run some tests!
Sorry, something went wrong.
There was a problem hiding this comment.
Yep, it seems moving those lines above the if branch has no effect, we still get stuck.
Sorry, something went wrong.
There was a problem hiding this comment.
@hassy Could you try re-running the tests on your machine with the following patch applied?
When I tried moving the conditional above, it ran fine locally.
diff --git a/lib/timers.js b/lib/timers.js
index 37ac317..d89a1d8 100644
--- a/lib/timers.js
+++ b/lib/timers.js
@@ -578,17 +578,18 @@ function processImmediate() {
immediateQueue.head = immediateQueue.tail = null;
while (immediate) {
+
+ if (!immediate._onImmediate) {
+ immediate = immediate._idleNext;
+ continue;
+ }
+
domain = immediate.domain;
if (domain)
domain.enter();
- if (immediate._onImmediate) {
- immediate._callback = immediate._onImmediate;
- } else {
- immediate = immediate._idleNext;
- continue;
- }
+ immediate._callback = immediate._onImmediate;
// Save next in case `clearImmediate(immediate)` is called from callback
var next = immediate._idleNext;
Sorry, something went wrong.
There was a problem hiding this comment.
Yep, that works (since we are moving onto the next immediate before continueing rather than just continuing as in the original if branch, which is what led to the infinite loop).
I think I misunderstood your first comment above and tested the wrong thing.
Sorry, something went wrong.
|
@sam-github The OP indicated that he tried to. |
Sorry, something went wrong.
|
@hassy What tests fail for you on OS X? What OS X version? (I use OS X and they pass for me with this commit.) Also, we have a handy guide for writing node core tests, once you are ready. :) |
Sorry, something went wrong.
|
Thanks @Fishrock123. I have added a regression test for the bug now - does that look OK? |
Sorry, something went wrong.
There was a problem hiding this comment.
Looking better, please run make -j4 lint though. :)
Sorry, something went wrong.
There was a problem hiding this comment.
This probably isn't needed, the test runner has a timeout mechanism of it's own.
If you think it is, the other file should be in /fixtures/.
Either way, this file should probably be in /parallel/.
Sorry, something went wrong.
There was a problem hiding this comment.
common.fail(message)
Sorry, something went wrong.
There was a problem hiding this comment.
does nothing, instead, wrap the callback in common.mustCall().
Sorry, something went wrong.
|
Thanks @Fishrock123! I replaced the test with a smaller one, in the right place, and linted too. :) |
Sorry, something went wrong.
|
Don't think any documentation needs to be updated for this? If the fix & the test look OK now, I'll squash the commits and write a proper commit message. |
Sorry, something went wrong.
|
@mscdex would you mind reviewing the patch please? I think you have the final say on whether this is OK or not. :-) |
Sorry, something went wrong.
There was a problem hiding this comment.
Tiny nit: could you put a common.fail(<message>) into each of these? Thanks!
Sorry, something went wrong.
There was a problem hiding this comment.
Could you also wrap this with common.mustCall()? :D
Sorry, something went wrong.
|
@hassy I've left a few comments (including one up above regarding the conditional placement), if you could fix these up we should be good to merge, I think. |
Sorry, something went wrong.
|
@Fishrock123 Thanks! Didn't get a notification on GH for some reason. I'll update the PR with the fixes. |
Sorry, something went wrong.
If current immediate has no callback, move on to the next one in the queue. Fixes: nodejs#9756 PR-URL: nodejs#9759
|
@Fishrock123 Is it OK to git push --force-with-lease with the final fixes and a proper commit message as per CONTRIBUTING.md? |
Sorry, something went wrong.
|
@hassy yes, we force push all the time to update PRs. Even just --force is fine. Feel free to squash the commits while you are at it too. :) |
Sorry, something went wrong.
|
@Fishrock123 Cool, done. :-) |
Sorry, something went wrong.
There was a problem hiding this comment.
Looks good to me. New CI: https://ci.nodejs.org/job/node-test-pull-request/5384/
Sorry, something went wrong.
|
@hassy btw your git info says your name is hveldstra <h@veldstra.org> If you would like to update it to a name you prefer more, you can update it like so: $ git config --global user.email "j.random.user@example.com"
$ git config --global user.name "J. Random User"Then $ git commit --amend --reset-author
$ git push origin head --forceOtherwise, just let us know that hveldstra is what you'd prefer to be known as in the commit history / Author file. :) Good to land otherwise. Sorry for the delay again. |
Sorry, something went wrong.
|
@Fishrock123 hveldstra is fine. Thanks for all of your help with this PR! |
Sorry, something went wrong.
|
Ok cool. Thanks for the contribution! Landed in 9f6f0f7 :D |
Sorry, something went wrong.
Notable changes
SEMVER-MINOR
- url:
- add inspect function to TupleOrigin (Safia Abdalla) #10039
- crypto:
- allow adding extra certs to well-known CAs (Sam Roberts) #9139
SEMVER-PATCH
- buffer:
- fix single-character string filling (Anna Henningsen) #9837
- handle UCS2 .fill() properly on BE (Anna Henningsen) #9837
- url:
- including base argument in originFor (joyeecheung) #10021
- improve URLSearchParams spec compliance (Timothy Gu) #9484
- http:
- remove stale timeout listeners (Karl Böhlmark) #9440
- build:
- fix node_g target (Daniel Bevenius) #10153
- fs:
- remove unused argument from copyObject() (Ethan Arrowood) #10041
- timers:
- fix handling of cleared immediates (hveldstra) #9759
PR-URL: #10277
Notable changes:
* **crypto**:
- Allow adding extra certificates to well-known CAs. (Sam Roberts)
[#9139](#9139)
* **buffer**:
- Fix single-character string filling. (Anna Henningsen)
[#9837](#9837)
- Handle UCS2 `.fill()` properly on BE. (Anna Henningsen)
[#9837](#9837)
* **url**:
- Add inspect function to TupleOrigin. (Safia Abdalla)
[#10039](#10039)
- Including base argument in originFor. (joyeecheung)
[#10021](#10021)
- Improve URLSearchParams spec compliance. (Timothy Gu)
[#9484](#9484)
* **http**:
- Remove stale timeout listeners. (Karl Böhlmark)
[#9440](#9440)
* **build**:
- Fix node_g target. (Daniel Bevenius)
[#10153](#10153)
* **fs**:
- Remove unused argument from copyObject(). (EthanArrowood)
[#10041](#10041)
* **timers**:
- Fix handling of cleared immediates. (hveldstra)
[#9759](#9759)
* **src**:
- Add wrapper for process.emitWarning(). (SamRoberts)
[#9139](#9139)
- Fix string format mistake for 32 bit node.(Alex Newman)
[#10082](#10082)
| Back | FazBrowse Home | New Git URL |
PR to go with: #9756
I am not familiar with timers, so the proposed solution could well be wrong. Looking forward to feedback on that!
Checklist
Affected core subsystem(s)
timers
Description of change
Remove the unnecessary if branch.
If current immediate has no callback, proceed onto the next one in the queue.