brutella / hkcam

Open-Source HomeKit Surveillance Camera
https://hochgatterer.me/hkcam/
Apache License 2.0
922 stars 141 forks source link

connection.go:112: Close connection and remove session #53

Closed edwardhughes closed 4 years ago

edwardhughes commented 4 years ago

I have a few hkcams in my home for a few weeks now. I've been testing the various models of Raspberry Pis and have had successfully working cameras in a Pi Zero W, Pi 3 B, and an original Pi Model B (same SOC as Pi Zero W IIRC). All work well, with the Pi 3 B being the most responsive, as expected. All were setup with the Ansible script on a fresh install of Raspbian Stretch.

I have been noticing in the last few days that they are tending to "lock up." The pi isn't "frozen," but the Homekit video is giving me the "No Response" error. Restarting the hkcam process corrects the issue. It might function fine for a few days, hours or minutes, but it usually repeats.

Here is a tail of the hkcam logfile at the moment it stops responding:

2019-07-19_12:36:46.24430 Press [q] to stop, [?] for help 2019-07-19_12:36:46.28123 frame= 1 fps=0.0 q=3.8 Lsize=N/A time=00:00:00.03 bitrate=N/A speed=0.907x 2019-07-19_12:36:46.28134 video:10kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown 2019-07-19_12:36:46.31362 DEBUG 2019/07/19 08:36:46 loopback.go:54: Stopping loopback 2019-07-19_12:36:46.31949 frame= 8 fps=0.0 q=-1.0 Lsize=N/A time=00:00:00.63 bitrate=N/A speed=2.62x 2019-07-19_12:36:46.31954 video:10800kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown 2019-07-19_12:36:46.34753 Exiting normally, received signal 2. 2019-07-19_12:36:55.88564 DEBUG 2019/07/19 08:36:55 connection.go:112: Close connection and remove session 2019-07-19_12:37:45.95535 DEBUG 2019/07/19 08:37:45 connection.go:112: Close connection and remove session 2019-07-19_12:37:46.05827 DEBUG 2019/07/19 08:37:46 connection.go:112: Close connection and remove session

I've done some digging and see that the error message comes from the hc dependency. I'm not sure why it is being called. Cleanup of network connections can be a good thing, but is this closing of the connection expected behavior?

edwardhughes commented 4 years ago

My mistake! Problem solved.

I recently added a managed switch to my Unifi gear and upgraded the firmware of all of my networking devices. A new option was added to allow the forcing of "high performance" wireless devices to the 5 gHz network. I enabled this, and it appears to have been the culprit. Along with that forcing it also disabled some parts of multicast and unicast on the wireless network, which I suspect was the actual cause of this strange behavior. All three of my hkcam devices have been functioning without issue for several hours now.

Thanks for the great project! I'm currently learning Go so that I can offer contributions in the future!