home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.11k stars 29.79k forks source link

SSDP error, ValueError: filedescriptor out of range in select() #45599

Closed supergroover closed 3 years ago

supergroover commented 3 years ago

The problem

I regularly get the error below in my log. Homeassistant seems to works fine and has no further problems

Environment

System Health

version 2021.1.5
installation_type Home Assistant OS
dev false
hassio true
docker true
virtualenv false
python_version 3.8.7
os_name Linux
os_version 5.4.86
arch x86_64
timezone Europe/Amsterdam
Home Assistant Community Store GitHub API | ok -- | -- Github API Calls Remaining | 4989 Installed Version | 1.10.1 Stage | running Available Repositories | 773 Installed Repositories | 17
Home Assistant Cloud logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Hass.io host_os | Home Assistant OS 5.10 -- | -- update_channel | stable supervisor_version | 2021.01.7 docker_version | 19.03.13 disk_total | 48.5 GB disk_used | 6.5 GB healthy | true supported | true board | ova supervisor_api | ok version_api | ok installed_addons | Samba share (9.3.0), Assistant Relay (0.7.4), File editor (5.2.0), Home Assistant Google Drive Backup (0.103.1), SSH & Web Terminal (7.8.0), Zigbee2mqtt (1.17.0.1), phpMyAdmin (0.2.0), MariaDB (2.2.1), Portainer (1.4.0)
Lovelace dashboards | 1 -- | -- mode | storage views | 5 resources | 9

Problem-relevant configuration.yaml

Unknown

Traceback/Error logs

Logger: homeassistant
Source: components/ssdp/__init__.py:57
First occurred: 26 januari 2021 21:01:26 (592 occurrences)
Last logged: 9:40:27

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/ssdp/__init__.py", line 72, in async_scan
    entries = await self.hass.async_add_executor_job(_run_ssdp_scans)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/ssdp/__init__.py", line 57, in _run_ssdp_scans
    return itertools.chain.from_iterable([ssdp.scan() for _ in range(3)])
  File "/usr/src/homeassistant/homeassistant/components/ssdp/__init__.py", line 57, in <listcomp>
    return itertools.chain.from_iterable([ssdp.scan() for _ in range(3)])
  File "/usr/local/lib/python3.8/site-packages/netdisco/ssdp.py", line 255, in scan
    ready = select.select(sockets, [], [], seconds_left)[0]
ValueError: filedescriptor out of range in select()

Additional information

probot-home-assistant[bot] commented 3 years ago

ssdp documentation ssdp source (message by IssueLinks)

elupus commented 3 years ago

My guess is one of your integrations are leaking sockets.

I would start by trying without any custom integration.

supergroover commented 3 years ago

Hi, that was one of the first things I did. Unfortunately this did not help.

I have removed all integrations, both custom and addons.

edit: When i turn discovery: on, i'm getting also this error

Logger: homeassistant
Source: components/discovery/__init__.py:223
First occurred: 17:43:05 (1 occurrences)
Last logged: 17:43:05

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/discovery/__init__.py", line 196, in scan_devices
    results = await hass.async_add_executor_job(
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/discovery/__init__.py", line 223, in _discover
    netdisco.scan(zeroconf_instance=zeroconf_instance)
  File "/usr/local/lib/python3.8/site-packages/netdisco/discovery.py", line 60, in scan
    self.ssdp.scan()
  File "/usr/local/lib/python3.8/site-packages/netdisco/ssdp.py", line 42, in scan
    self.update()
  File "/usr/local/lib/python3.8/site-packages/netdisco/ssdp.py", line 90, in update
    entry for entry in scan()
  File "/usr/local/lib/python3.8/site-packages/netdisco/ssdp.py", line 255, in scan
    ready = select.select(sockets, [], [], seconds_left)[0]
ValueError: filedescriptor out of range in select()
SamJongenelen commented 3 years ago

I have the same log issue. These messages bug me, so lets compare:

Logger: homeassistant
Source: components/ssdp/__init__.py:57
First occurred: February 17, 2021, 3:31:45 PM (1509 occurrences)
Last logged: 4:39:54 PM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/ssdp/__init__.py", line 72, in async_scan
    entries = await self.hass.async_add_executor_job(_run_ssdp_scans)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/ssdp/__init__.py", line 57, in _run_ssdp_scans
    return itertools.chain.from_iterable([ssdp.scan() for _ in range(3)])
  File "/usr/src/homeassistant/homeassistant/components/ssdp/__init__.py", line 57, in <listcomp>
    return itertools.chain.from_iterable([ssdp.scan() for _ in range(3)])
  File "/usr/local/lib/python3.8/site-packages/netdisco/ssdp.py", line 255, in scan
    ready = select.select(sockets, [], [], seconds_left)[0]
ValueError: filedescriptor out of range in select()

My integrations are:

My suspicions are on the ones which aren't as common as, say, MobileApp. I've highlighted less common integrations. Are there in my list any integrations you also have @supergroover ?

Can custom automations in the HACS integrations also be a culprit? I've read you've disabled all integrations. Did you delete entities/devices as well?

edit: I run without #discovery: in my config, but with ssdp:

supergroover commented 3 years ago

So glad someone else has this problem 😜. I use the integrations below.

I have actually already removed all integrations once. Which I then reinstalled one by one at 1 day interval. After a while this error came back, sometimes even that homeassistant did not respond at all.

SamJongenelen commented 3 years ago

Ok, so I've been thinking sony bravia or kodi is the issue. Do you use the bravia over wifi? I do and the integration regularly loses connection. Maybe this is the culprit?

eloebl commented 3 years ago

I've had this issue for months now too... Only plugins I have in common are MQTT, Google Cast and HACS.

I suspect there may be a networking issue here with one of the plugins, here's why... I've been chasing for months the Chromecasts plugin will go off into the weeds and HA can't reach them anymore (but work fine from every other network device I have) until I restart HA ( @SamJongenelen Are you also seeing this?). Also when I lose the Chromecasts, often if I try to reconnect to my MQTT server, it can't reconnect either, until I restart as well. During this time my logs fill with this SSDP error error as well.

My HA instance is loaded on a Dell SFF system using the Intel NUC Supervised image.

SamJongenelen commented 3 years ago

This confirms socket leak to me. What hacs integrations do you have?

eloebl commented 3 years ago

@SamJongenelen That's exactly what I've been suspecting as well, but not sure how to prove/debug it.

HACS integrations, (however I had this issue before any of these integrations were installed):

My HA Integrations:

SamJongenelen commented 3 years ago

In my situation, I'm using three different google cast devices over wifi, which do have unstable wifi indeed.

I'll await the update for the pycast component from your other bug

github-actions[bot] commented 3 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

SamJongenelen commented 3 years ago

I've since moved away from Ubuntu to supported host and my errors are gone. I've used restore snapshot fwiw

bdraco commented 3 years ago

The SSDP implementation was replaced since this was opened.