-
Sat 2021.05.08
re 'again via setInterval I push the collected strings'
re 'Also, the device works for few hours and then stops sending data'New interpreter error: CALLBACK,MEMORY
Hi @gdanov , what techniques are being used to check memory? There really isn't enough here to make a definitve response. The above however, leads me to believe that memory is being gobbled up. It is quite possible that a setInterval is buried inside a repetative loop, or something of the sort, from which then, Espruino is being blocked from perfofming the necessary garbage collection.Has
process.memory()
been viewed to determine usage as time moves along? Please post before, during and after.'but it looks like both setInterval handlers are cancelled?'
Is the trailing question mark indicating a guess here, was a check actually done?
If it hasn't been discovered yet, these commands entered into L-Hand WebIDE console will reveal the state of memory.
console.log(global["\xFF"].timers); //nice, less info trace(global["\xFF"].timers); //full info
As @MaBe pointed out in post #2 it'll be much easier to assist with the actual code. Please post.
-
Thanks for the debugging hints. I knew none of this. Where should I look for more debugging hints?
setInterval is called once from the main context. These are my timers in normal situation:
global["\xFF"].timers =[ undefined, undefined, undefined, { time: 140550, interval: 300000, callback: function (undefined) { ... } }, { time: 1342468, interval: 3000000, callback: function (undefined) { ... } } ]
this is memory (again under normal conditions)
{ free: 1563, usage: 737, total: 2300, history: 23, gc: 538, gctime: 2.717, blocksize: 16 }
I'll definitelly incorporate your and @AkosLukacs hints into the error handling and debugging when it crashes again.
so, I left it connected via tcp and this is what seems relevant:
I get some exceptions in the http put ("Uncaught InternalError: Unable to create socket" included) but it looks like both setInterval handlers are cancelled? the one reading temperature did not throw visible exceptions.