kelly / node-i2c

Node.js native bindings for i2c-dev. Plays well with Raspberry Pi and Beaglebone.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Segfault

risacher opened this issue · comments

I repeatably get a segfault that I think is in i2c, but it takes a few hours for it to happen. During that time, the process size grows slowly, so maybe it's a memory leak issue?

I am using node 0.10.33 and adafruit-i2c-lcd on a raspberry pi B; with i2c module pulled from latest github. The test program scrolls text across the lcd display, changing the text on a 100ms interval.

Unfortunately when the segfault happens, it seems to corrupt the stack, so I haven't been able to get a good backtrace in gdb or core file.

Here's the test program that causes the crash: http://risacher.org/ref/test2-buttons.js

if anyone has tips on how to debug this, I'd much appreciate.

You could try upgrading to the latest version of i2c. It looks like that project depends on 0.1.4, but you shouldn't have any problems upgrading it to 0.1.6.

well, what I actually put in the adafruit-i2c-lcd/package.json dependencies is this:

"i2c": "git://github.com/kelly/node-i2c.git"

But it doesn't help

[edited]The segfault always happens inside ReadBlock().

At src/i2c.cc:133
The SEGV happens on this line:
Local actualBuffer = bufferConstructor->NewInstance(3, constructorArgs);

Did this SEGV ever get resolved?

I don't think so. I haven't tested it lately - that project went on indefinite hold. I'll try it tonight.

I upgraded to node 0.12.6; ran npm update, which pulled in i2c v0.2.1. I then ran my test program and let it run all night - no segfault. I forgot to check for process growth. I'm running the test again, but I think the problem is resolved. If it hasn't crashed by tonight, I'll close the issue.

Thanks for your work testing this! I am running Node 10.38 on a PI-2, I have not been able to get the PI to load version Node 12. What platform are you running? I tested with another i2c program and it ran OK, but I used readByte and not readyBytes (block), I would assume it would fail if I used the block mode also until upgrade node, based on my reading.

My pi's (I think I have 3) are RPi 1 Model B. I installed node 0.12.6 via instructions at http://weworkweplay.com/play/raspberry-pi-nodejs/ - basically a installed a package built by heroku.

Thanks, I will take a look at this, it will save me a lot of time if it works.

I have been testing for a while with node 0.12.6 and it seems to be working fine. I don't notice the memory leak that were there with 0.10.38. Strange it was intermittent when it came to how long the process ran before the segfault.

No crash; no leak. Closing.