node icon indicating copy to clipboard operation
node copied to clipboard

setInterval not working on Raspberry Pi.

Open ZiCog opened this issue 10 years ago • 29 comments

A number of people are observing that setInterval is not working for large intervals on the Raspberry Pi.

The following code:

setInterval (function () {
    console.log("Tick: ");
}, 1000 * 60 * 30);

Never produces any output for example. (It does work for a 1 minute interval, changing the 30 to a 1 say)

This issue does seem to come and go, some report never seeing it. It's under discussion here: https://www.raspberrypi.org/forums/viewtopic.php?f=34&t=128624

Node version v5.2.0

Operating system: Raspbian Jessie.

ZiCog avatar Dec 13 '15 00:12 ZiCog

This is still an issue in Node 6.9.3 on RPi. Will also try the patch.

jamesfmackenzie avatar Apr 05 '17 07:04 jamesfmackenzie

Oh yeah, forgot about this. Took my Raspberry Pi 3 days to build Node from source and eventually threw some errors when I tried to run my app, so couldn't test this. Should try to run the test script, but currently no time. Works with the keep-alive interval that triggers console output every ±10 minutes which is ok enough for me at the moment.

sebastiaanluca avatar Apr 05 '17 10:04 sebastiaanluca

Facing the same issue on Raspberry PI 3. Yes, the only work-around so far is having keep-alive interval.

setInterval(fn, 30 * 60 * 1000); // your actual interval

setInterval(() => {}, 10 * 60 * 1000) // keep-alive interval

husa avatar Apr 05 '17 10:04 husa

Can someone with access to a Raspberry Pi confirm this is still a problem with Node.js 8.x?

Trott avatar Aug 04 '17 05:08 Trott

Cannot reproduce on RPi3, latest Arch Linux ARM, Kernel 4.9.36, node v8.2.1:

$ node -e 'setInterval (function () { console.log("Tick: "); }, 1000 * 60 * 30);'
Tick:
Tick:

silverwind avatar Aug 05 '17 17:08 silverwind

@silverwind can you confirm it fails with v5.2.0 (i.e. negative control)? If it does IMHO we can close this.

refack avatar Aug 05 '17 18:08 refack

Although the code @bnoordhuis is pointing to hasn't changed since v2.30 https://github.com/nodejs/node/pull/1889/files#diff-c2053e03dec17e31a49b19d166265122

refack avatar Aug 05 '17 18:08 refack

Yep, fails with 5.2.0. I think we can safely assume this is fixed.

silverwind avatar Aug 05 '17 20:08 silverwind

To confirm. This bug is certainly fixed for node v8.1.2 running on Raspbian GNU/Linux 8 on Raspbery Pi 3.

ZiCog avatar Aug 07 '17 21:08 ZiCog