-
• #2
I would say check your, and all libraries for
clearInterval
.
AclearWatch
in DHT22 cleared all my watches. It's a different command, but similar behaviour and effects... And a related conversation . -
• #3
It's really likely that
clearInterval
got called withundefined
as an argument as @AkosLukacs says.If you install the 2v03 firmware then I've changed the way it works, so if you call
clearInterval(undefined)
rather than justclearInterval()
then it'll throw an exception.What you can then do is either leave a PC connected to the serial port of the MDBT42Q logging what it outputs, or you can log it to RAM:
var log=""; LoopbackB.on('data',d=>log+=d); NRF.on('disconnect', function(reason) { LoopbackA.setConsole(); });
Now when you disconnect all outputs get logged to
log
. When you reconnect you can just runprint(log)
to see what got printed - and if there was an exception then it'll be in there along with a stack trace of where it occurred. -
• #5
Update: I ran a similar script on a pixljs and could see the error when in a state running a high-frequency interval. I'm guessing the interval is too frequent causing a backlog of operations and resulting in a low memory error. I will try increasing the interval period and re-running the test.
1 Attachment
-
• #6
Great - at least that's some help.
You could try printing
process.memory().usage
every so often to see if there's some kind of leak that gets worse over time? -
• #7
Thanks for the tip. I ran some experiments with different intervals and I did see the memory usage increase from 219 to 254 when reducing the interval from 2000ms to 200ms and vice-versa saw the memory use decrease when increasing the interval, so I think this is a helpful tool to determine what the fastest interval can be.
-
• #8
If you need to you can actually look in
global["\xff"].timers
to see what intervals are running - might be some help?For the 'out of memory' problem you should hopefully see the memory usage keep rising over time as well.
After running for some time (a few weeks or so) the interval set with setInterval() and modified periodically with changeInterval() will unexpectedly stop. Interval periods are set between 1000ms and 100ms. When I connect to the device I try to use changeInterval() on the console and get "Uncaught Error: Unknown Interval" so it appears the interval is gone, as if clearInterval() was called. I checked to see if that could be the case and am not seeing anything. Is there a reason why the an interval would stop except calling clearInterval()? Is there a max time an interval can run?