HA Crashing with OSError: [Errno 24] Too many open files

Hi Everyone,

I have HA running in Fedora since 3 years.

V 2021.3.2
Home Assistant Core
Docker = false
Virtual Environment = true
Python = 3.8.6

And since I made the last update, my HA is crashing after some time up. I restart it, it runs and crash again.

Trying to debug I already:

  • turned off InfluxDB
  • turned off NabuCasa connection

Log file shows me:

2021-03-08 20:41:47 ERROR (MainThread) [homeassistant] Error doing job: socket.accept() out of system resource
Traceback (most recent call last):
File “/usr/lib64/python3.8/asyncio/selector_events.py”, line 164, in _accept_connection
conn, addr = sock.accept()
File “/usr/lib64/python3.8/socket.py”, line 292, in accept
fd, addr = self._accept()
OSError: [Errno 24] Too many open files

Running lsof I see tons of:

hass 2414237 2414850 hass homeassistant 21u IPv4 15858753 0t0 TCP aletiha:40214->151.101.6.133:https (ESTABLISHED)
hass 2414237 2414850 hass homeassistant 22u IPv4 15817120 0t0 TCP aletiha:40014->151.101.6.133:https (ESTABLISHED)
hass 2414237 2414850 hass homeassistant 23u IPv4 15837747 0t0 TCP aletiha:40118->151.101.6.133:https (ESTABLISHED)
hass 2414237 2414850 hass homeassistant 24u IPv4 15840805 0t0 TCP aletiha:40128->151.101.6.133:https (ESTABLISHED)
hass 2414237 2414850 hass homeassistant 25u IPv4 15844533 0t0 TCP aletiha:40140->151.101.6.133:https (ESTABLISHED)

Do you have some suggestion or idea ?

Do you recognize this IP ? It’s always the same 151.10.6.133 …

THANK YOU !

Marcelo

Boy !!! I turned off almost everything (Nabucasa, Google Integration, Spotify, InfluxDB, Graphana, Waze) and these connections still coming up !!!

I am starting to think I have some Linux Virus :smile: Regards
Marcelo

Just for kicks, what is the IP to your homeassistant host?
Have you tried re-creating your virtualenv (please back up your current one if you attempt)

1 Like

Hi M0E-lnx, my HA’s internal IP is in the range of 192.168.x.y so it’s not the same. My router external IP is 65.3X.3x15 and it’s also not the same.

I see these connections in netstat as well.

I tried to browse this IP and it is from Miami but doesn’t tell me so much.

Well, recreate my machine would be an option but you know … trying to find the reason is funnier.

Do you see these connections in your HA ?

I agree, you should find out why your box is establishing those connections and it should be a fun challenge. Maybe try to narrow it down some by not even starting homeassistant and see if the connections persist. I’m very much interested on your quest, so please post what you find

I would probably start by finding out which programs are making the connections. Maybe something like netstat -A inet -p or ss -tp on your box that runs homeassistant.

1 Like

Hi MOE-lnx

I gave up and decided to delete my venv and create a new one. I was a little bit concerned about some vulnerability so I decided to end my slow investigation. It was with sure coming from HA. I tried to turn off HA and these connections were gone. I turned on HA, they were coming up again.

Thanks for your help on this

I’m not sure I helped much, but I have been reading some concerning things about bad code infiltrating pypi and npm repositories around, so I was curious if this was one of those and if so, which package.

1 Like