Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
This repository was 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

Description

@ploer

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions