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

[BUG] Socket closes and can't be reopened, which results in a sigint for homebridge #341

Closed
blssed opened this issue Feb 14, 2021 · 20 comments
Assignees
Labels
bug Something isn't working waiting for feedback Waiting for feedback from users

Comments

@blssed
Copy link

blssed commented Feb 14, 2021

(Harmony Hub)WARNING - socket closed is

the first thing that comes up followed by

(Harmony Hub)ERROR (1)- refreshCurrentActivity TimeoutError: Can't open WebSocket within allowed timeout: 10000 ms. - Stack : TimeoutError: Can't open WebSocket within allowed timeout: 10000 ms.
at PromiseController._handleTimeout (/usr/local/lib/node_modules/homebridge-harmony/node_modules/promise-controller/src/index.js:172:19)
at Timeout. (/usr/local/lib/node_modules/homebridge-harmony/node_modules/promise-controller/src/index.js:178:43)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7)
[14/02/2021, 04:37:24] Got SIGTERM, shutting down Homebridge...

I can't find out what is triggering the socket to close, maybe you can point me somewhere?

As I haven't found the trigger for this idk how it could be reproduced.

My harmony config looks like this:
"name": "Harmony Hub", "hubIP": "192.168.1.75", "TVAccessory": true, "mainActivity": "TV", "platform": "HarmonyHubWebSocket"

@blssed blssed added the bug Something isn't working label Feb 14, 2021
@nicoduj
Copy link
Owner

nicoduj commented Feb 14, 2021

Hi, are you sure your harmony hub has got a fixed IP on your router / dhcp server ?

@blssed
Copy link
Author

blssed commented Feb 14, 2021

Yes I just checked, its fixed to .75, when I restart the homebridge process it instantly works again too.
It always seems to happen after 24-36 hours(rarely in the first 24 hours of hb running) and gets my homebridge process crashed.

netstat -a also shows a working connection to harmony hub, if that's relevant.

@nicoduj
Copy link
Owner

nicoduj commented Feb 16, 2021

Another question : are you on Hoobs or Classic Homebridge ? Other users that reported this issue, it was network related, on dhcp renewal.

@blssed
Copy link
Author

blssed commented Feb 16, 2021

Because I had to google what Hoobs is, I guess im on classic homebridge. :)
DHCP renewal shouldn't happen when there is a fixed IP address, right?

@nicoduj
Copy link
Owner

nicoduj commented Feb 16, 2021

It should not, but it depends if it is a prefered ip or reserved one I think. What dhcp are you using ? Like I said, the problem is network related, and the fact that it happens every 24 hours or so is likely to be linked.

Di you try putting your hub offline and online again and see if it is doing the same ?

I am also interested into your exact conf (node version, homebridge version, npm dependency list ...)

@blssed
Copy link
Author

blssed commented Feb 16, 2021

My router(FRITZ!Box 7590) is acting as the DHCP. There is a checkmark "Always assign the same IPv4 address to this network device." which is activated, so that should be reserved, not preferred I think.

Im not in the house where this problem is happening, but I'll ask someone to try this behaviour with me by shutting the hub off and turning it back on.

Node Version: 14.15.4
Npm Version: 7.5.2
Homebridge Version: 1.2.5

What do you mean by npm dependency list? npm ls -g?

That outputs:
/usr/local/lib
├── @milo526/homebridge-tuya-web@1.0.0
├── homebridge-config-ui-x@4.38.0
├── homebridge-harmony@1.4.1
├── homebridge-rademacher-homepilot@0.6.10
├── homebridge-xiaomi-roborock-vacuum@0.16.1
├── homebridge-yeelight-wifi@2.3.0
├── homebridge@1.2.5
├── n@6.7.0
└── npm@7.5.2

@blssed
Copy link
Author

blssed commented Feb 20, 2021

I've just checked, pulling the plug, leaving it out for 30 sec and putting it back on will result in:

[Harmony Hub] (Harmony Hub)WARNING - socket closed

But it doesn't crash the bridge and no further errors/warnings.
I guess the connection reestablishes itself.

@nicoduj
Copy link
Owner

nicoduj commented Feb 20, 2021

Hi, Did you try to refresh home app while it was plugged off ?

@nicoduj nicoduj added this to To do in Harmony Hub Plugin for Homebridge via automation Feb 20, 2021
@nicoduj nicoduj added this to the 1.5.0 milestone Feb 20, 2021
@blssed
Copy link
Author

blssed commented Feb 20, 2021

We had home app active while it was plugged off. It showed "reagiert nicht" for harmony hub, saying it doesnt react, and after a few seconds it responded again.

@nicoduj
Copy link
Owner

nicoduj commented Feb 20, 2021

Could you please post the full log when the crash is happening (if possible with homebridge running in DEBUG mode). The log in my plugin is in a catch, so it must crash somewhere else

@blssed
Copy link
Author

blssed commented Feb 20, 2021

Ok, I will setup homebridge in debug mode and turn harmony-hub back on(turned off for usability reasons, didnt want crashes every other day).
I will report back when it crashed again, may take some time.

@nicoduj
Copy link
Owner

nicoduj commented Feb 20, 2021

ok, thx

@nicoduj nicoduj added the waiting for feedback Waiting for feedback from users label Feb 20, 2021
@nicoduj nicoduj removed this from the 1.5.0 milestone Feb 20, 2021
@blssed
Copy link
Author

blssed commented Feb 20, 2021

I hope this question is not too stupid, but I just started homebridge with:
sudo DEBUG=* homebridge -D -U /root/.homebridge (i hope this is the correct way to start it in debug?)

Now it doesnt write to the log anymore.

Could you point me in the right direction here?
I cant find anything on google

@blssed
Copy link
Author

blssed commented Feb 20, 2021

Even without DEBUG=* it doesnt write to the log file at /var/log/homebridge.log anymore

@nicoduj
Copy link
Owner

nicoduj commented Feb 20, 2021

Sorry, I d'ont understand, the fact that ther is no more log is not plugin related. I have done some test, can reproduce the socket close when i turn off my hub, but as soon as it goes back online it is ok, and homebridge does not crash meanwhile ...

@blssed
Copy link
Author

blssed commented Feb 20, 2021

Okay, thanks anyways. I will find out why there is no log written when started with debug by myself then! :)

@nicoduj
Copy link
Owner

nicoduj commented Feb 20, 2021

If you are using config ui, you can use it to enable the debug mode .

If you don't manage to have the debug log, I am still interested into the whole log with time stamps before and after the error

@blssed
Copy link
Author

blssed commented Feb 20, 2021

I actually just found out about that. Works now. I'll get back as soon as I have new information!

@blssed
Copy link
Author

blssed commented Feb 23, 2021

I just encountered weird behaviour with the harmony hub.
Homebridge crashed again and I before I tried to restart it, I tried pinging to the harmony hub, no answer, netstat -a shows no active connection there. The Webinterface of the router showed a active and working connection tho.
Starting the homebridge results in the WebSocket not being started. 20 mins later it all worked great again.
It seems the harmony hub is shutting off itself or something and I haven't noticed yet because I was always noticing the crash a few hours after it already crashed.

Seems your plugin isn't the cause of this. We'll be sending in the harmony hub and getting a new one, I hope that fixes our problems.

@nicoduj
Copy link
Owner

nicoduj commented Feb 23, 2021

Hi, ok thanks for feedback. Did you enable xmpp on the hub ? It is not necessary so maybe disabling it would improve .

@nicoduj nicoduj closed this as completed Apr 20, 2021
Harmony Hub Plugin for Homebridge automation moved this from To do to Done Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting for feedback Waiting for feedback from users
Development

No branches or pull requests

2 participants