omcaree / node-pololumaestro

Node module for control of Pololu Maestro servo controllers
14 stars 16 forks source link

Crash on possible EventEmitter memory leak detected. #11

Open 1am opened 9 years ago

1am commented 9 years ago

Hi

I've been using your library for a while but lately it started having some problems with sending messages to the driver. It fails with the following error (acually it's a warning but it's the last thing which is output):

at EventEmitter.addListener (events.js:179:15)
   at EventEmitter.once (events.js:204:8)
   at EventEmitter.SerialPortWrapper.write (/Users/.../node_modules/pololu-maestro/lib/serialportwrapper.js:51:8)
   at EventEmitter.PololuMaestro._sendCommand (/Users/.../node_modules/pololu-maestro/lib/pololumaestro.js:313:19)
   at EventEmitter.PololuMaestro.setTarget (/Users/.../node_modules/pololu-maestro/lib/pololumaestro.js:92:7)
   at null.<anonymous> 
...

The amount 101 is there beacause I've increased the node's max event listeners count to 100. It was 10 before with the same result. I've tested the latest version of node-pololumaestro with OSX 10.10.5, node.js 0.12.7, 0.12.4 and 0.12.3 and all yield the same result. Is there something which can be done to overcome the issue or is it somehow known to you?

1am commented 9 years ago

I' m wondering if this could not be caused by the this._awaitingRead check in https://github.com/omcaree/node-pololumaestro/blob/master/lib/serialportwrapper.js#L50 Seems like the _awaitingRead flag is never set to true nor false

1am commented 9 years ago

What we also found is that this happens repeatedly on mac minis (tested on 2 different devices) while on an macbook pro (somewhere around 2011-12) the code works fine without any modifications.