Too many open files with Unifi device tracker and new LIFX lights components

I’ve been fighting a major recent problem I’ve been having with HA that results in “too many open files” errors on a MASSIVE scale… Still working to figure it out, but this seems relevant…

pi@homepi:~ $ sudo lsof | wc -l
pi@homepi:~ $ sudo lsof |grep homeassistant |wc -l
pi@homepi:~ $ sudo lsof |grep homeassistant |grep -i lifx |wc -l
pi@homepi:~ $ sudo lsof |grep homeassistant |grep -i ubnt |wc -l
pi@homepi:~ $ sudo lsof |grep homeassistant |grep -vi ubnt | grep -vi lifx |wc -l

Here’s a graph of “sudo lsof | wc -l” and “sudo -u homeassistant | wc -l” :

screen shot 2017-04-07 04 45 30 pm

The large cliffs are restarts of HA. Is anyone else experiencing this with either of these components? It makes using HA almost impossible without frequent restarts.

According to this post, WebOS TV has a similar problem leaking files

Both of these components were not having this issue in their previous incarnation… Chasing up the Lifx one first… Will see about the Unifi component next.

If this is helpful to anyone here is my lsof log at the time when there are already too many open files.

So other people are happy to tolerate a home automation system that can only run for a maximum of about 20 hours at a time? Nobody else is bothered? Or affected?

Could this be related to the PyUnifi2.0 update one month ago? @finish06

Think I’m running into the same issue and I’m guessing its caused by lifx:

(hass) hass@home-pvr:~/.homeassistant$ lsof | grep 56700 | wc -l

I hadn’t noticed any errors from this, but I ran across this thread and was curious myself

Looking at the open files, I visually noticed that a lot of them were TCP connections to Chromecast devices. They all have chrome in the hostname so I was able to filter them out.

pi@ha:~ $ lsof | grep 2595 | wc -l
pi@ha:~ $ lsof | grep 2595 | grep chrome | wc -l

Seems excessive

If you use the lifx component, download the latest version, rename it as custom component in the appropriate directory (i.e. .homeassistant/custom_components/light/ and then add:

  - platform: lifxtest

to your configuration.yaml

This not only fixed the lifx component for me, but also fixed the totally unrelated Unifi device tracker which was leaking files twice as badly. don’t ask me why as I have NO idea.

Looks like it might be fixed in 0.42.3 anyway…