I have a strange problem where long SetTimeouts do not start on Raspberry PI, but they work on Ubuntu / x64 and OSX.
'use strict'; const delay = 1000 * 3600 * 8; const date = new Date(); date.setTime(new Date().getTime() + delay); console.log('Alarm set to', date.toString()); setTimeout(function () { console.log('Alarm!', new Date()); }, delay);
This code will echo Alarm! after 8 hours on Ubuntu / x64, but it never launches RPI.
Works:
Does not work:
- RPI b + with Raspian 7 (Node 6.1)
- RPI 3 with Raspian 8 (Node 4.4.4, 6.0 and 6.1)
According to ps script is in the state Sl : Interruptible sleep (waiting for an event to complete), is multi-threaded (using CLONE_THREAD, like NPTL pthreads do).
In a more complex version of this code, where I can control the script through the web interface, the alarm goes off after a set time, but only when accessing the web interface (to wake up the application?).
Is this a NodeJS bug or am I doing something funky?
source share