elad-bar / ha-blueiris

Integration with Blue Iris Video Security Software
184 stars 43 forks source link

Excessive TIME_WAIT sockets on BI server from Home Assistant #179

Open exx76 opened 2 years ago

exx76 commented 2 years ago

If I restart HA and restart BI, I have a total of 8 sockets in TIME_WAIT on my HA server. As soon as I click to a tab to view cameras, HA begins consuming sockets on BI. It appears to not be reusing existing connections. Over a 30 second period of viewing a dashboard with 2 camera feeds on it, a total of 267 sockets were observed in the TIME_WAIT status. Over the following 5 minutes, that number had increased to 1037.

I do not have streaming enabled, and have tried with both h264 and mjpeg. The behavior is the same.

HA Supervisor 2022.08.3 HA Core 2202.8.6 HAOS 8.4 Frontend 20220802.0 - latest BI Integration latest available version BI server 5.5.9.6

This issue has persisted for some time, with previous versions of all components. only today did I finally dig into it and see the sockets in TIME_WAIT.

In the attached example, you can see the 2 ESTABLISHED sessions from HA to BI, and the other 1000+ sockets in TIME_WAIT. The end result of this is port exhaustion.

I have attempted to remove and re-add the integration as mentioned by the poster in the issue re: high CPU utilization, to no avail.

netstat example.txt