tessel / gprs-sim900

[UNMAINTAINED] JavaScript module for the SIM900 2G driver.
Other
14 stars 7 forks source link

Fix postmaster memory leak #26

Closed heikki closed 9 years ago

heikki commented 9 years ago

Removes post event listener and resets postmaster on timeout.

Btw .once and .removeListener don't work together. I'm not sure if they're supposed to.

heikki commented 9 years ago

Created separate issue from once/removeListener problem https://github.com/tessel/runtime/issues/599

jiahuang commented 9 years ago

It's been a while since I looked at this code. I'm trying to make sense of it again,

Did the line you remove (self.removeListener('post', reply);) do anything? It doesn't look like it did.

What was happening with the memleak? I'm guessing that post events kept attaching without it ever being removed.

heikki commented 9 years ago

That removed line didn't do anything.

Every timeout left one post event listener there. They were cleared on successfull post though. Bigger problem with timeout was that RXQueue wasn't cleared. Sometimes it led to overflow and sometimes it caused next command to fail even though the received data was valid.

tm-rampart commented 9 years ago

Approved by @jiahuang. Running tests.

jiahuang commented 9 years ago

Thanks for tracking that bug down :)