As the title says... Chat on...

User avatar
By NullPointer
#61470 As a recent exploration into Lua, I've been moving some devices around the house from the Arduino implementation to Lua. I have currently two Lua nodes that report sensor data to a webserver. Now, I'm a fairly experienced programmer and I'll figure it out eventually, but wondering if folks here could point me in the right direction.

The Arduino nodes run for around two months without intervention from me. The Lua ones, so far, about two days. This is likely my fault, however it's not the usual suspects. The heap is fine, and the node does not crash it simply does not post data any more (to be clear, the Arduino nodes on the same network are fine). If I send an HTTP request to it (in its hung state) it then reboots.

Are there issues with the net, socket and tmr modules that make sure the node can't stay up for any length of time? Pretty sure the tmr module is ok as it still fires even though the net and socket modules hang. As an aside, the net module reports 200OK on POST or GET even if network connectivity has been cut. Makes diagnostics somewhat harder.

Is there a stable ROM I should be testing against? Good fun this Lua stuff, just finding it a little hard to get some stability.
User avatar
By marcelstoer
#61471 Obvious question first: which firmware version?

Can you leave the module(s) connected to a serial console so that you'd see the crash report when it reboots?
Have you tried reducing the scope of your application as to corner the areas that could fail?
How do you know heap is fine?

NullPointer wrote:Are there issues with the net, socket and tmr modules


There is no socket module.

NullPointer wrote:As an aside, the net module reports 200OK on POST or GET even if network connectivity has been cut.


How can it do that? If the connectivity is cut it can't possibly report anything. I don't get this one.
User avatar
By NullPointer
#61494 I meant websocket, not socket! I posted this after a long day, apologies. Worse than that, the 200OK code I was mysteriously receiving was due to the fact I was turning off the wrong router during the test. I'm an idiot.

I know that the heap is fine because I have it reported to the server every post the node makes, and it holds at around 20K. I'm doing what you suggest, I have one permanently connected to a serial monitor and I'll observe what happens when it becomes unresponsive and reduce the scope from there.

The firmware is 1.5.4.1(39cb9a32), at least that's the number reported at boot. Would I be better flashing from the dev branch?
User avatar
By marcelstoer
#61496
NullPointer wrote:The firmware is 1.5.4.1(39cb9a32), at least that's the number reported at boot. Would I be better flashing from the dev branch?


No, just wanted to make sure it's not some old 0.9.x version.