-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
setInterval not working on Raspberry Pi. #4262
Comments
Looks similar/identical to #2326 |
@fivdi Seems to be the same issue and solution I'm using, e.g. an intermediate 20-minute See node-schedule/node-schedule#218 for the original issue. Thought it was an issue with their library, but turned out the simplest examples and then |
Confirmed. Adding a setInterval with a short period keeps every thing working nicely. |
Can one of you run this with debug enabled? $ NODE_DEBUG=timer node -p "setInterval(function(){console.log('.')}, 1000 * 60 * 30)" |
Running it. I have another node process running so perhaps I might have to restart it if it triggers after 30 minutes (haven't tested the issue with 2 non-related node apps using |
@silverwind This is the only output after running it 24 hours, immediately after entering the command:
|
Ah, that's kind of expected. I'm thinking this might be related to a recent v8 upgrade. Not sure what the best debugging steps are, but I'd see if it's reproducible in the d8 shell first. What kind of Raspberry Pi is it, by the way? |
This is on a Pi 2 Model B v1.1.
|
And an original Pi type B :)
|
Is this still an issue? |
@jasnell Yep, still need to use a 10/20-minute timer to prevent it from sleeping, but even that sometimes doesn't work. |
@jasnell I can confirm that this issue is also present on Raspberry Pi 3 model B, running OSMC:
It's not only Tested with Node.js v5.10.1 and v4.4.3. |
I can also confirm that this issue is present in node v6.0.0 with Raspbian 8, on Pi 2 model B, |
I'm having the same issue on
http://stackoverflow.com/questions/37153589/long-settimeout-in-nodejs-on-raspberry-pi |
Can someone try this patch? See also #2326 (comment). diff --git a/deps/uv/src/unix/linux-core.c b/deps/uv/src/unix/linux-core.c
index fb8ac3f..8a2693f 100644
--- a/deps/uv/src/unix/linux-core.c
+++ b/deps/uv/src/unix/linux-core.c
@@ -169,7 +169,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
* the value of CONFIG_HZ. The magic constant assumes CONFIG_HZ=1200,
* that being the largest value I have seen in the wild (and only once.)
*/
- static const int max_safe_timeout = 1789569;
+ static const int max_safe_timeout = 6e4;
static int no_epoll_pwait;
static int no_epoll_wait;
struct uv__epoll_event events[1024]; |
Closing, inactive for > 6 months. |
Still an issue though. Not sure how to test that patch… |
$ git clone --depth 1 https://github.com/nodejs/node
$ cd node
$ vim patch # paste patch
$ git apply patch
$ ./configure && make -j $(nproc)
$ ./node -v |
@sebastiaanluca did the patch work? @silverwind, maybe I'm not understanding correctly, but wouldn't you want to increase |
@avonmoll I'll look into it this weekend. Needs to run for a while to know for sure. |
This is still an issue in Node 6.9.3 on RPi. Will also try the patch. |
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. |
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 |
Can someone with access to a Raspberry Pi confirm this is still a problem with Node.js 8.x? |
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 can you confirm it fails with |
Although the code @bnoordhuis is pointing to hasn't changed since |
Yep, fails with 5.2.0. I think we can safely assume this is fixed. |
To confirm. This bug is certainly fixed for node v8.1.2 running on Raspbian GNU/Linux 8 on Raspbery Pi 3. |
- Fixed issue on iphone X where buttons would wrap - Added keep alive to server to prevent pi from sleeping on old version of node nodejs/node#4262
A number of people are observing that setInterval is not working for large intervals on the Raspberry Pi.
The following code:
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.
The text was updated successfully, but these errors were encountered: