tessel / t2-cli

Tessel 2 Command Line Interface
MIT License
114 stars 56 forks source link

post-mortem debugging #786

Closed boneskull closed 8 years ago

boneskull commented 8 years ago

So I have a script pushed to my T2. It periodically reads sensor values and transmits them.

It does this successfully for about 48 hours, then stops. This happens consistently. I know it has stopped when the 3 leds which were constanly on (PortA, Power, PortB) become one (Power).

I can include the script itself here, but what I'm really curious about is finding out how and why it crashes. Given that it happens after a pretty regular amount of time, I'm guessing it may be a memory leak.

boneskull commented 8 years ago

Here's the script, fwiw.

johnnyman727 commented 8 years ago

@boneskull I recommend checking out this article - it has some excellent tips for tracking down Node memory leaks.

The first dependency it mentions, memwatch, unfortunately isn't compiling properly but I was able to use heapdump myself and view the status of the Heap within Chrome after scping the snapshot to myself. You could take snapshots at a regular interval and then once the script crashes, download the snapshot and inspect it. That should get you to the source of the leak.

rwaldron commented 8 years ago

Do you have a schematic or diagram for the custom module? I'd like to try my hand at assembling that.

I'm guessing it may be a memory leak.

By your description, I agree. I will be traveling this weekend, but will take time to try and repro as soon as I can

rwaldron commented 8 years ago

A design question: what is the motivation for using a TMP36 and BMP180? The BMP180 provides both temp and pressure; it will also always be more accurate than the TMP36.

boneskull commented 8 years ago

@rwaldron I couldn't get accurate temperature readings from the BMP180. I am not sure why. It is reading 4-5 F higher than it should. I figured it was just a bad module. The TMP36 is a little better.

I should give it a shot attached to an arduino or something to eliminate T2 as the culprit. Thereafter I should use C instead of J5 if it's still having problems.

rwaldron commented 8 years ago

Can you do a run without losant-sdk-js and report the outcome?

rwaldron commented 8 years ago

Also, if you're only reading every 20 seconds, you can optimize the entire program by changing the actual sampling interval rate: http://johnny-five.io/examples/board-sampling-interval/

johnnyman727 commented 8 years ago

Closing this for now as there are no action items.