Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wink hub reboots while running wink-mqtt #14

Open
jfath opened this issue Jan 3, 2017 · 13 comments
Open

Wink hub reboots while running wink-mqtt #14

jfath opened this issue Jan 3, 2017 · 13 comments

Comments

@jfath
Copy link

jfath commented Jan 3, 2017

I have a rooted wink hub running the latest firmware (3.4.4). When I run ./mqtt start I see the 'Starting mqtt...' message and my mqtt broker log shows the connection and subscription requests. I can publish a message from another mqtt client and the wink hub will turn on/off a Z-Wave device as requested. Everything seems to be working as expected.
The problem is, the wink hub will do a full reboot a few minutes after starting wink-mqtt. If I don't start wink-mqtt, the same hub will run indefinitely as expected. The reboot doesn't seem linked to sending or receiving messages - it will happen if I simply run ./mqtt start then leave the wink basically idle. I started the app from a ssh session and checked the log from the serial terminal during the run - no errors or anything suspicious.
Any thoughts on how I might find some clues about what is causing the reboot?

@causalloop
Copy link

I think its a CPU/resource utilization problem - there's some lines in....... monitrc? about auto-rebooting if the CPU is above a certain amount for some amount of time (might be wrong about the time portion - it may just reboot).

I was never able to actually get this working on.. I want to say 3.3xsomething

You might be able to get around it by commenting out the lines in (I think) monitrc, though given the lack of heat sinks and cooling, it might be related to keeping the CPU from doing bad things if they didn't think to include any thermal protection (the poor mans temp control lol). Have to test that theory :-P

As an aside, I'm curious if any of this going to get updated for the newer firmware(s) or is this project going to get dropped in lieu of the new wink hub?

@danielolson13
Copy link
Owner

danielolson13 commented Jan 3, 2017 via email

@causalloop
Copy link

😞
If you don't mind me asking, did you move on to a different platform etc or did you just lose motivation (totally understandable all things considered)

@jfath
Copy link
Author

jfath commented Jan 3, 2017

Thanks danielolson13 for the work you've done. I don't think it's far from working with the latest firmware. It's completely functional on 3.4.4 until the reboot.
I think causalloop is correct about the reboot coming from monitrc. At first glance, I see reboots dependant on the amount of memory used by node processes. It seems likely that some resource is being hit harder than the original devs expected. I'm going to try upping limits and/or commenting out reboots in monitrc to see if I can keep it running.

@jfath
Copy link
Author

jfath commented Jan 4, 2017

Looks like the reboot is triggered by a high memory usage situation in 3.4.4. When I change the monitrc reboot actions to alerts, I see monit log errors about memory usage that would have definitely triggered a reboot. The interesting thing is, after I had left the wink running for about a day without running wink-mqtt, the errors triggered immediately and wink-mqtt would abort. After a reboot, wink-mqtt will start and run for several hours before the high memory usage alerts are triggered. It seems there is a memory leak in the 3.4.4 firmware or at least some process that gradually consumes more memory.
I'll do some more digging to see if I can find the process that's eating memory.

@causalloop
Copy link

causalloop commented Jan 4, 2017 via email

@danielolson13
Copy link
Owner

danielolson13 commented Jan 4, 2017 via email

@causalloop
Copy link

causalloop commented Jan 4, 2017 via email

@jfath
Copy link
Author

jfath commented Jan 4, 2017

I wasn't completely clear in stating memory usage steadily increases when wink-mqtt isn't running at all. I think the wink firmware has a problem and the monit reboot is a brute force fix. That threshold is reached more quickly when wink-mqtt is running due to expected increased memory usage.
If I can figure out the offending process and restart that process instead of doing a full reboot, we may have a simple solution.

@causalloop
Copy link

causalloop commented Jan 4, 2017 via email

@jfath
Copy link
Author

jfath commented Jan 5, 2017

I first saw the steady memory increase when I changed the monitrc reboots to alerts. Eventually, monit started logging memory usage alerts: 75%, 75.1%, 75.2% ....
I also checked top with wink-mqtt running and neither wink-mqtt.js nor server.js (the main node based process) were increasing in memory usage, so I think it's something else. I turned on logging in my terminal and ran top -b to capture about 10 minutes of top measurements. When I get a few minutes, I need to go through the log and see if I can pick out the offending process.

@Syco54645
Copy link

@jfath Were you able to find anything out here? Tired of my hub rebooting at night and turning all of my lights on (so tired in fact that I am about to just buy a zigbee/zwave stick).

@atomicsamurai
Copy link

First off, thanks for this great project Dan. I know I am super late to this. Anyways, I faced similar instability issues (reboots etc.) on my wink and my hunch was a memory leak in nodejs was the culprit. I rewrote part of the application in golang and I am having good results stability wise. Hope this can help others too: https://github.com/sandman0/wink-mqtt-go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants