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

Homebridge Crashs and shutdown #66

Closed
niwre2019 opened this issue Apr 5, 2019 · 6 comments
Closed

Homebridge Crashs and shutdown #66

niwre2019 opened this issue Apr 5, 2019 · 6 comments

Comments

@niwre2019
Copy link

Hello,
Unfortunately, I have a problem with the plugin. Basically, the plugin works fine, but after about a day, Homebridge is shutdown, an excerpt from the log file I have attached. I currently use Homebridge 0.4.47, Node JS 11.60 and NPM 6.9.0 on a RaspberryPi 2 B and Stretch, all other plugins are working fine. Is there a solution, I would like to use the plugin.

Log:
Error: read ECONNRESET
Apr 04 11:29:33 HomeKit homebridge[16732]: at TCP.onStreamRead (internal/stream_base_commons.js:162:27)
Apr 04 11:29:33 HomeKit homebridge[16732]: [2019-4-4 11:29:33] Got SIGTERM, shutting down Homebridge...
Apr 04 11:29:33 HomeKit homebridge[16732]: [2019-4-4 11:29:33] [ZP] cleaning up...
Apr 04 11:29:33 HomeKit homebridge[16732]: [2019-4-4 11:29:33] [Logitech] INFO - shutdown
Apr 04 11:29:33 HomeKit homebridge[16732]: [2019-4-4 11:29:33] [HomeMatic] Removing Event Server for Interface BidCos-RF.
Apr 04 11:29:33 HomeKit homebridge[16732]: [2019-4-4 11:29:33] [HomeMatic] Removing Event Server for Interface HmIP-RF.
Apr 04 11:29:33 HomeKit homebridge[16732]: [2019-4-4 11:29:33] [ZP] exit

@ebaauw
Copy link
Owner

ebaauw commented Apr 5, 2019

Could you attach the full log file, or at least show the lines before the ECONNRESET?

homebridge-zp installs a handler for otherwise uncaught exceptions, that would cause NodeJS to crash. Instead it issues a controlled shutdown, so the subscriptions to the Sonos speakers can be cancelled before terminating.

@niwre2019
Copy link
Author

Enclosed an excerpt from a log file with more content.

Mar 27 08:22:19 HomeKit homebridge[6832]: [2019-3-27 08:22:19] Homebridge is running on port 51826.
Mar 27 08:22:19 HomeKit homebridge[6832]: [2019-3-27 08:22:19] [ZP] Sonos Soundbar: coordinator for group Soundbar
Mar 27 08:22:19 HomeKit homebridge[6832]: [2019-3-27 08:22:19] [ZP] Sonos Mobil: coordinator for group Mobil
Mar 27 08:22:19 HomeKit homebridge[6832]: [2019-3-27 08:22:19] [ZP] Sonos Esszimmer: coordinator for group Esszimmer
Mar 27 08:22:19 HomeKit homebridge[6832]: [2019-3-27 08:22:19] [ZP] Sonos Esszimmer: platform coordinator
Mar 27 08:22:20 HomeKit homebridge[6832]: [2019-3-27 08:22:20] [ZP] Sonos Bad: coordinator for group Bad
Mar 27 08:22:20 HomeKit homebridge[6832]: [2019-3-27 08:22:20] [ZP] Sonos Wohnzimmer: member of group Sonos Esszimmer
Mar 27 08:22:20 HomeKit homebridge[6832]: [2019-3-27 08:22:20] [ZP] Sonos Küche: member of group Sonos Esszimmer
Mar 27 08:22:20 HomeKit homebridge[6832]: [2019-3-27 08:22:20] [ZP] Sonos Wohnzimmer: set volume from undefined to 10
Mar 27 08:22:20 HomeKit homebridge[6832]: [2019-3-27 08:22:20] [ZP] Sonos Wohnzimmer: set balance from undefined to 0
Mar 27 08:22:20 HomeKit homebridge[6832]: [2019-3-27 08:22:20] [ZP] Sonos Wohnzimmer: set mute from undefined to false
Mar 27 08:22:20 HomeKit homebridge[6832]: [2019-3-27 08:22:20] [ZP] Sonos Wohnzimmer: set bass from undefined to 0
Mar 27 08:22:20 HomeKit homebridge[6832]: [2019-3-27 08:22:20] [ZP] Sonos Wohnzimmer: set treble from undefined to 0
Mar 27 08:22:20 HomeKit homebridge[6832]: [2019-3-27 08:22:20] [ZP] Sonos Wohnzimmer: set loudness from undefined to true
Mar 27 08:22:20 HomeKit homebridge[6832]: [2019-3-27 08:22:20] [ZP] Sonos Mobil: set volume from undefined to 2
Mar 27 08:22:20 HomeKit homebridge[6832]: [2019-3-27 08:22:20] [ZP] Sonos Mobil: set mute from undefined to false
Mar 27 08:22:20 HomeKit homebridge[6832]: [2019-3-27 08:22:20] [ZP] Sonos Mobil: set bass from undefined to 0
Mar 27 08:22:20 HomeKit homebridge[6832]: [2019-3-27 08:22:20] [ZP] Sonos Mobil: set treble from undefined to 0
Mar 27 08:22:20 HomeKit homebridge[6832]: [2019-3-27 08:22:20] [ZP] Sonos Mobil: set loudness from undefined to true
Mar 27 08:22:20 HomeKit homebridge[6832]: [2019-3-27 08:22:20] [ZP] Sonos Soundbar: set power (play/pause) from undefined to false
Mar 27 08:22:20 HomeKit homebridge[6832]: [2019-3-27 08:22:20] [ZP] Sonos Soundbar: set current track from undefined to ""
Mar 27 08:22:20 HomeKit homebridge[6832]: [2019-3-27 08:22:20] [ZP] Sonos Bad: set volume from undefined to 46
Mar 27 08:22:20 HomeKit homebridge[6832]: [2019-3-27 08:22:20] [ZP] Sonos Bad: set mute from undefined to false
Mar 27 08:22:20 HomeKit homebridge[6832]: [2019-3-27 08:22:20] [ZP] Sonos Bad: set bass from undefined to 0
Mar 27 08:22:20 HomeKit homebridge[6832]: [2019-3-27 08:22:20] [ZP] Sonos Bad: set treble from undefined to 0
Mar 27 08:22:20 HomeKit homebridge[6832]: [2019-3-27 08:22:20] [ZP] Sonos Bad: set loudness from undefined to true
Mar 27 08:22:20 HomeKit homebridge[6832]: [2019-3-27 08:22:20] [ZP] Sonos Küche: set volume from undefined to 26
Mar 27 08:22:20 HomeKit homebridge[6832]: [2019-3-27 08:22:20] [ZP] Sonos Küche: set mute from undefined to false
Mar 27 08:22:20 HomeKit homebridge[6832]: [2019-3-27 08:22:20] [ZP] Sonos Küche: set bass from undefined to 0
Mar 27 08:22:20 HomeKit homebridge[6832]: [2019-3-27 08:22:20] [ZP] Sonos Küche: set treble from undefined to 0
Mar 27 08:22:21 HomeKit homebridge[6832]: [2019-3-27 08:22:20] [ZP] Sonos Küche: set loudness from undefined to true
Mar 27 08:22:21 HomeKit homebridge[6832]: [2019-3-27 08:22:21] [ZP] Sonos Esszimmer: set volume from undefined to 12
Mar 27 08:22:21 HomeKit homebridge[6832]: [2019-3-27 08:22:21] [ZP] Sonos Esszimmer: set balance from undefined to 0
Mar 27 08:22:21 HomeKit homebridge[6832]: [2019-3-27 08:22:21] [ZP] Sonos Esszimmer: set mute from undefined to false
Mar 27 08:22:21 HomeKit homebridge[6832]: [2019-3-27 08:22:21] [ZP] Sonos Esszimmer: set bass from undefined to 0
Mar 27 08:22:21 HomeKit homebridge[6832]: [2019-3-27 08:22:21] [ZP] Sonos Esszimmer: set treble from undefined to 0
Mar 27 08:22:21 HomeKit homebridge[6832]: [2019-3-27 08:22:21] [ZP] Sonos Esszimmer: set loudness from undefined to true
Mar 27 08:22:21 HomeKit homebridge[6832]: [2019-3-27 08:22:21] [ZP] Sonos Wohnzimmer: set power (play/pause) from undefined to true
Mar 27 08:22:21 HomeKit homebridge[6832]: [2019-3-27 08:22:21] [ZP] Sonos Mobil: set power (play/pause) from undefined to false
Mar 27 08:22:21 HomeKit homebridge[6832]: [2019-3-27 08:22:21] [ZP] Sonos Mobil: set current track from undefined to ""
Mar 27 08:22:21 HomeKit homebridge[6832]: [2019-3-27 08:22:21] [ZP] Sonos Soundbar: set volume from undefined to 10
Mar 27 08:22:21 HomeKit homebridge[6832]: [2019-3-27 08:22:21] [ZP] Sonos Soundbar: set balance from undefined to 0
Mar 27 08:22:21 HomeKit homebridge[6832]: [2019-3-27 08:22:21] [ZP] Sonos Soundbar: set mute from undefined to false
Mar 27 08:22:21 HomeKit homebridge[6832]: [2019-3-27 08:22:21] [ZP] Sonos Soundbar: set bass from undefined to 0
Mar 27 08:22:21 HomeKit homebridge[6832]: [2019-3-27 08:22:21] [ZP] Sonos Soundbar: set treble from undefined to 0
Mar 27 08:22:21 HomeKit homebridge[6832]: [2019-3-27 08:22:21] [ZP] Sonos Soundbar: set loudness from undefined to false
Mar 27 08:22:21 HomeKit homebridge[6832]: [2019-3-27 08:22:21] [ZP] Sonos Bad: set power (play/pause) from undefined to false
Mar 27 08:22:21 HomeKit homebridge[6832]: [2019-3-27 08:22:21] [ZP] Sonos Bad: set current track from undefined to "ANTENNE BAYERN"
Mar 27 08:22:21 HomeKit homebridge[6832]: [2019-3-27 08:22:21] [ZP] Sonos Küche: set power (play/pause) from undefined to true
Mar 27 08:22:21 HomeKit homebridge[6832]: [2019-3-27 08:22:21] [ZP] Sonos Esszimmer: unknown track metadata {"$":{"id":"-1","parentID":"-1","restricted":"true"},"res":[{"_":"x-sonosapi-hls-static:catalog%2ftracks%2fB076MB8GCG%2f9026fee7-f9d6-4ecf-90cf-dcbd399209a4%2fd0093fd2-2941-441d-8424-99ada71d90b2%2fAYUYQJV0168PK%2fn%2fUNLIMITED%2f683a9fd6-deff-448d-a8ac-0168c683e6b3%2fUNLIMITED_STATION%2f17a42a41-0d7b-45d9-9a7a-b47fc4371614%2f?sid=201&flags=0&sn=7","$":{"protocolInfo":"sonos.com-http::application/x-mpegURL:","duration":"0:03:31"}}],"r:streamContent":[""],"r:radioShowMd":[""],"upnp:albumArtURI":["/getaa?s=1&u=x-sonosapi-hls-static%3acatalog%252ftracks%252fB076MB8GCG%252f9026fee7-f9d6-4ecf-90cf-dcbd399209a4%252fd0093fd2-2941-441d-8424-99ada71d90b2%252fAYUYQJV0168PK%252fn%252fUNLIMITED%252f683a9fd6-deff-448d-a8ac-0168c683e6b3%252fUNLIMITED_STATION%252f17a42a41-0d7b-45d9-9a7a-b47fc4371614%252f%3fsid%3d201%26flags%3d0%26sn%3d7"],"dc:title":["Free"],"upnp:class":["object.item.audioItem.musicTrack"],"dc:creator":["Michael Patrick Kelly"],"upnp:album":["iD - Extended Version"]}
Mar 27 08:22:21 HomeKit homebridge[6832]: [2019-3-27 08:22:21] [ZP] Sonos Esszimmer: set power (play/pause) from undefined to false
Mar 27 08:22:21 HomeKit homebridge[6832]: [2019-3-27 08:22:21] [ZP] Sonos Esszimmer: set current track from undefined to "Free"
Mar 27 08:22:21 HomeKit homebridge[6832]: [2019-3-27 08:22:21] [ZP] Sonos Mobil: set group volume from undefined to 2
Mar 27 08:22:21 HomeKit homebridge[6832]: [2019-3-27 08:22:21] [ZP] Sonos Mobil: set group mute from undefined to false
Mar 27 08:22:21 HomeKit homebridge[6832]: [2019-3-27 08:22:21] [ZP] Sonos Soundbar: set group volume from undefined to 10
Mar 27 08:22:21 HomeKit homebridge[6832]: [2019-3-27 08:22:21] [ZP] Sonos Soundbar: set group mute from undefined to false
Mar 27 08:22:21 HomeKit homebridge[6832]: [2019-3-27 08:22:21] [ZP] Sonos Bad: set group volume from undefined to 46
Mar 27 08:22:21 HomeKit homebridge[6832]: [2019-3-27 08:22:21] [ZP] Sonos Bad: set group mute from undefined to false
Mar 27 08:22:21 HomeKit homebridge[6832]: [2019-3-27 08:22:21] [ZP] Sonos Esszimmer: set group volume from undefined to 16
Mar 27 08:22:21 HomeKit homebridge[6832]: [2019-3-27 08:22:21] [ZP] Sonos Esszimmer: set group mute from undefined to false
Mar 27 08:24:47 HomeKit homebridge[6832]: [2019-3-27 08:24:47] [HomeMatic] Saving 14.6 for BidCos-RF.MEQ0788947:4
Mar 27 08:32:41 HomeKit homebridge[6832]: [2019-3-27 08:32:41] [ZP] uncaught exception
Mar 27 08:32:41 HomeKit homebridge[6832]: Error: read ECONNRESET
Mar 27 08:32:41 HomeKit homebridge[6832]: at TCP.onStreamRead (internal/stream_base_commons.js:162:27)
Mar 27 08:32:41 HomeKit homebridge[6832]: [2019-3-27 08:32:41] Got SIGTERM, shutting down Homebridge...
Mar 27 08:32:41 HomeKit homebridge[6832]: [2019-3-27 08:32:41] [ZP] cleaning up...
Mar 27 08:32:41 HomeKit homebridge[6832]: [2019-3-27 08:32:41] [Logitech] INFO - shutdown
Mar 27 08:32:41 HomeKit homebridge[6832]: [2019-3-27 08:32:41] [HomeMatic] Removing Event Server for Interface BidCos-RF.
Mar 27 08:32:41 HomeKit homebridge[6832]: [2019-3-27 08:32:41] [HomeMatic] Removing Event Server for Interface HmIP-RF.
Mar 27 08:32:41 HomeKit homebridge[6832]: [2019-3-27 08:32:41] [ZP] exit

@niwre2019
Copy link
Author

In addition to my last comment, a note, the Homebridge usually runs about a day before it crashes. Unfortunately, I do not have a logfile anymore because I deactivated the plugin because of the error. But I would love to use it again, so I contacted you about Github.

Is it possible to deactivate the controlled shutdown for testing?

@ebaauw
Copy link
Owner

ebaauw commented Apr 6, 2019

In addition to my last comment, a note, the Homebridge usually runs about a day before it crashes.

That's probably with the same ECONNRESET error. The one-line stack trace seems to indicate the error originates in NodeJS itself. Looks like nodejs/node#27065 and nodejs/node#23169.

Is it possible to deactivate the controlled shutdown for testing?

There's no setting for that, you'll have to uncomment the setup of the handler.

process.on('uncaughtException', (error) => {
this.log.error('uncaught exception\n%s', error.stack)
if (!this.shuttingDown) {
process.kill(process.pid, 'SIGTERM')
}
})

Note that as of v0.4.48, homebridge itself handles the uncaught exceptions (see homebridge/homebridge#2190). I'll be removing this function from homebridge-zp in the next release, later this weekend.

@niwre2019
Copy link
Author

Thanks for the answer, I'm waiting for the update and will test the plugin again. Maybe I'll be lucky and it will work again. Thanks for the plugin, it's really great.

@niwre2019
Copy link
Author

The Homebridge is now running stable for 2 days and hopefully it stays that way. Thank you for the quick help and the update.

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

2 participants