Hexagon / node-telldus

Node bindings for telldus-core
Other
34 stars 10 forks source link

Crashes node app #54

Closed olekenneth closed 8 years ago

olekenneth commented 10 years ago

Hi

I get this error several times a day.

node: ../deps/uv/src/unix/threadpool.c:236: uv__queue_done: Assertion `((&(req->loop)->active_reqs == (&(req->loop)->active_reqs)->prev) == 0)' failed.

I use the Tellstick Duo with firmware 12 on a Debian machine.

Hexagon commented 10 years ago

Hmm, that's a tricky one!

64 or 32 bits? Which version of node?

olekenneth commented 10 years ago
root@server:~# uname -m
x86_64
root@server:~# node -v
v0.10.25
michaelsund commented 10 years ago

I have the same problem (x64 with node v0.10.22), and sometimes my listener just stops recieving updates from sensors, allthough i can still see them getting updated with telldus --list

olekenneth commented 10 years ago

@michaelsund does it crash your app or does the app stop getting updates?

michaelsund commented 10 years ago

Both, ive gotten the same error as you maybe once a day and nodemon doesnt restart the app. And maybe every other day the sensor event listener just stops recieving data. allthough the rest of the app continues to work.

olekenneth commented 10 years ago

Do you have the latest firmware?

michaelsund commented 10 years ago

Nope, gonna do a upgrade and see if it makes any difference

Edit: With the latest firmware (12 i think it was for duo) i still get problem with events suddenly not being recieved anymore until a restart of the application.

Havent seen the threadpool error yet though.

Hexagon commented 10 years ago

Well, I might have some progress on this, I've noticed there is a quite heavy memory leak when running with lots of configured sensors and devices. That could have something to do with the threadpool error above ( which i still hasn't been able to reproduce :/ )

michaelsund commented 10 years ago

Got a new error today, ive stripped out everything in my application except telldus and a func to keep the program running. Segmentation fault (core dumped)

kmpm commented 10 years ago

Do you have a sample code?

hugosp commented 10 years ago

node: ../deps/uv/src/unix/threadpool.c:236: uv__queue_done: Assertion `((&(req->loop)->active_reqs == (&(req->loop)->active_reqs)->prev) == 0)' failed.

same error here , always in the middle of the night , anyone found a solution yet ?

michaelsund commented 10 years ago

I have been running my application with this module for a while, seems like when i updated my tellstick duo's firmware some of the problems was resolved. Cant say for sure though, i still need to restart the app sometimes because the events just stops. Im currently forwarding the tellstick via a hypervisor to my virtual machine running the app. Im gonna set it up on a dedicated host to atleast rule that layer out, but thats another story :) nothing todo with above error.

hugosp commented 10 years ago

Strange , i'm on latest firmware on my duo ,version 12 if thats the one you mean and no beta , seams like the errors started when i added a telldus.addDeviceEventListener to my project , can it be somekind of memory-leak in that function ? becouse it happens after about 6 hours of it running .

havent been digging into your code and checking , but just my thoughts

Hexagon commented 10 years ago

Interesting that it only happens after a device event listener is added, that will certainly help in isolating the exact issue. Will give it another go in a couple of weeks unless anyone else beats me to it :)

kmpm commented 10 years ago

I'v made a small project that I will leave running that uses addDeviceEventListener. https://github.com/kmpm/node-tellmqtt

I'll leave it running on a Raspberry Pi for some time and see if I get something similar.

Hexagon commented 10 years ago

A possible fix is merged and ready for testing!

Hexagon commented 9 years ago

Any news on this in the later versions?

michaelsund commented 9 years ago

I have been running the lib on a raspberry pi for 2 weeks without a glitch. Guess the usb-forwarding to the hypervisor was one of my problems.

Hexagon commented 9 years ago

Thanks @michaelsund , sounds promising!

@olekenneth ?

olekenneth commented 9 years ago

All good :-)

Hexagon commented 9 years ago

Nice! Closing this, don't hesitate to reopen if the problem returns :)

Z3TA commented 9 years ago

"version": "0.0.9" nodejs: ../deps/uv/src/unix/threadpool.c:236: uv__queue_done: Assertion `((&(req->loop)->active_reqs == (&(req->loop)->active_reqs)->prev) == 0)' failed.

uname -m x86_64 nodejs -v v0.10.25

Telldus firmware: 12

Z3TA commented 8 years ago

Here's another error, same system:

* Error in `/usr/bin/nodejs': free(): invalid pointer: 0x00000000007654e8 *

Z3TA commented 8 years ago

Here's some debug info before the error in threadpool.c

2015-11-11 (09:48:08_401 debug: sensorEvent: deviceId=199, protocol=temperaturehumidity, model=fineoffset, type=2 value=43, timestamp=1447231688 2015-11-11 (09:48:15_472 debug: RAW: class:sensor;protocol:fineoffset;id:135;model:temperaturehumidity;humidity:66;temp:8.6; 2015-11-11 (09:48:15_472 debug: sensorEvent: deviceId=135, protocol=temperaturehumidity, model=fineoffset, type=1 value=8.6, timestamp=1447231695 2015-11-11 (09:48:15_472 debug: sensorEvent: deviceId=135, protocol=temperaturehumidity, model=fineoffset, type=2 value=66, timestamp=1447231695 2015-11-11 (09:48:22_624 debug: RAW: class:sensor;protocol:fineoffset;id:215;model:temperaturehumidity;humidity:55;temp:11.6; 2015-11-11 (09:48:22_624 debug: sensorEvent: deviceId=215, protocol=temperaturehumidity, model=fineoffset, type=1 value=11.6, timestamp=1447231702 2015-11-11 (09:48:22_625 debug: sensorEvent: deviceId=215, protocol=temperaturehumidity, model=fineoffset, type=2 value=55, timestamp=1447231702 2015-11-11 (09:48:30_495 debug: RAW: class:sensor;protocol:fineoffset;id:167;model:temperaturehumidity;humidity:41;temp:20.0; 2015-11-11 (09:48:30_496 debug: sensorEvent: deviceId=167, protocol=temperaturehumidity, model=fineoffset, type=1 value=20.0, timestamp=1447231710 2015-11-11 (09:48:30_496 debug: sensorEvent: deviceId=167, protocol=temperaturehumidity, model=fineoffset, type=2 value=41, timestamp=1447231710 2015-11-11 (09:48:39_983 debug: RAW: class:sensor;protocol:fineoffset;id:151;model:temperaturehumidity;humidity:82;temp:5.2; nodejs: ../deps/uv/src/unix/threadpool.c:236: uv__queue_done: Assertion `((&(req->loop)->active_reqs == (&(req->loop)->active_reqs)->prev) == 0)' failed.

Hexagon commented 8 years ago

This seem to be because uv_queue isn't thread safe,i guess the chances of this happening is increasing tremendously if listening to both rawDataEvent and sensorEvent at the same time. As these two happens at the exact same time.

Try that as a workaround, I'll look into a solution when there is time :)

Hexagon commented 8 years ago

(removed jibberish)

Hexagon commented 8 years ago

A real solution pushed, replace uv_queue_work with uv_async

Z3TA commented 8 years ago

I've tested the new version and it no longer crashes, but it randomly
stops receiving data witch is much worse!

I get around 4-5 sensor events per second but do not notice anything weird
before it just stops receiving any data.

On Tue, 15 Dec 2015 20:17:06 +0100, Robin Nilsson
notifications@github.com wrote:

I just pushed a possible solution for this, where i removed the deletes
from reqest objects. Can anyone who had this error try out the latest
version on >npm?

— Reply to this email directly or view it on GitHub.

Hexagon commented 8 years ago

How often (in average) does this happen, and in which listener (device/sensor/raw)?

Z3TA commented 8 years ago

I've made my app restart if there is no sensor activity (all listeners) for two minutes and that happens about two times per day. I also still get "./deps/uv/src/unix/core.c:161: uv_close: Assertion `0' failed." error message, but only 1-3 times per week.