Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

unrefed interval timers not firing as expected in 0.10.34 #8900

Closed
ploer opened this issue Dec 18, 2014 · 6 comments
Closed

unrefed interval timers not firing as expected in 0.10.34 #8900

ploer opened this issue Dec 18, 2014 · 6 comments
Assignees
Milestone

Comments

@ploer
Copy link

ploer commented Dec 18, 2014

It appears to me that after upgrading to 0.10.34, a setInterval() call that is unref()ed will only fire once and then not recur.

Example code:

var timer = setInterval(function() {
  console.log("timer fired");
}, 1000);

timer.unref();

console.log("Unrefed timer should fire every 1 second");

setTimeout(function() {
  console.log("Exiting after 5 seconds");
  process.exit();
}, 5000);

Output on 0.10.33, which is as expected, and 0.10.34, which only fires once and then doesn't recur:

ploer-macbook-4:timer_test ploer$ node --version
v0.10.33
ploer-macbook-4:timer_test ploer$ node timer_test.js 
Unrefed timer should fire every 1 second
timer fired
timer fired
timer fired
timer fired
Exiting after 5 seconds
ploer-macbook-4:timer_test ploer$ node --version
v0.10.34
ploer-macbook-4:timer_test ploer$ node timer_test.js 
Unrefed timer should fire every 1 second
timer fired
Exiting after 5 seconds
ploer-macbook-4:timer_test ploer$ 

Not sure if this is related to issue #8897, but the symptoms seem quite different, and although I've encountered both of them they were in different circumstances.

@ploer
Copy link
Author

ploer commented Dec 18, 2014

Just at a guess, in 0d05123, at timers.js:296:

+function unrefdHandle() {
+  this.owner._onTimeout();
+  if (!this.owner.repeat)
+    this.owner.close();
+}

Should that be this.owner._repeat?

@misterdjules
Copy link

Thank you @ploer for reporting the issue and looking into it. Indeed, the issue seems to be caused by 0d05123. @trevnorris could you please take a look?

@misterdjules misterdjules added this to the 0.10.35 milestone Dec 18, 2014
misterdjules pushed a commit to misterdjules/node that referenced this issue Dec 19, 2014
This change fixes a regression introduced by commit
0d05123, which contained a typo that
would cause every unrefd interval to fire only once.

Fixes nodejs#8900.
@misterdjules
Copy link

@ploer We have a candidate for a fix with #8906, thank you very much for your help.

@ploer
Copy link
Author

ploer commented Dec 19, 2014

@misterdjules , thanks for the quick response & for all your contributions to node!

@misterdjules
Copy link

@ploer No problem, it's a team effort! Hopefully we'll be able to communicate soon when these fixes will be released.

misterdjules pushed a commit to misterdjules/node that referenced this issue Dec 19, 2014
This change fixes a regression introduced by commit
0d05123, which contained a typo that
would cause every unrefd interval to fire only once.

Fixes nodejs#8900.

Reviewed-By: Timothy J Fontaine <tjfontaine@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
@misterdjules
Copy link

@ploer Thanks again, landed in 78db74d.

mscdex pushed a commit to mscdex/node that referenced this issue Dec 25, 2014
This change fixes a regression introduced by commit
0d05123, which contained a typo that
would cause every unrefd interval to fire only once.

Fixes nodejs#8900.

Reviewed-By: Timothy J Fontaine <tjfontaine@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
jasnell pushed a commit to jasnell/node-joyent that referenced this issue Jan 5, 2015
This change fixes a regression introduced by commit
0d05123, which contained a typo that
would cause every unrefd interval to fire only once.

Fixes nodejs#8900.

Reviewed-By: Timothy J Fontaine <tjfontaine@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Fishrock123 pushed a commit to Fishrock123/node that referenced this issue Apr 2, 2015
This change fixes a regression introduced by commit
0d05123, which contained a typo that
would cause every unrefd interval to fire only once.

Fixes: nodejs/node-v0.x-archive#8900
Reviewed-By: Timothy J Fontaine <tjfontaine@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
indutny pushed a commit to indutny/io.js that referenced this issue Apr 3, 2015
This change fixes a regression introduced by commit
0d05123, which contained a typo that
would cause every unrefd interval to fire only once.

Fixes: nodejs/node-v0.x-archive#8900
Reviewed-By: Timothy J Fontaine <tjfontaine@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
indutny pushed a commit to nodejs/node that referenced this issue Apr 3, 2015
This change fixes a regression introduced by commit
0d05123, which contained a typo that
would cause every unrefd interval to fire only once.

Fixes: nodejs/node-v0.x-archive#8900
Reviewed-By: Timothy J Fontaine <tjfontaine@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants