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.14k stars 29.82k forks source link

aioharmony creates tasks without holding a strong reference which results in them being garbage collected before they finish #50492

Open KennethLavrsen opened 3 years ago

KennethLavrsen commented 3 years ago

The problem

For something like a year I have seen this in the log every single time I start Home Assistant.

[homeassistant] Error doing job: Task was destroyed but it is pending!

I cannot trace what causes it. Last year people reported it as related to automations but I tried to remove all automations that run at start and it did not make a difference.

I have enabled debugging in the HA log and pasted the entire log below

What is version of Home Assistant Core has the issue?

2021.5.2

What was the last working version of Home Assistant Core?

At least a year ago

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Harmony

Link to integration documentation on our website

https://www.home-assistant.io/integrations/harmony/

Example YAML snippet

N/A

Anything in the logs that might be useful for us?

021-05-11 23:05:17 DEBUG (Thread-16) [pychromecast.socket_client] [Workshop Speaker(None):8009] Resolved service ServiceInfo(type='mdns', data='Google-Home-Mini-ad732ef4ef84f7a56c4399774142397e._googlecast._tcp.local.') to 192.168.1.76:8009
2021-05-11 23:05:17 DEBUG (Thread-16) [pychromecast.socket_client] [Workshop Speaker(192.168.1.76):8009] Connecting to 192.168.1.76:8009
2021-05-11 23:05:17 DEBUG (MainThread) [homeassistant.helpers.translation] Cache miss for en-GB: sensor.deconz, sensor.amcrest, sensor.mobile_app, switch.deconz, binary_sensor.amcrest, light.deconz, binary_sensor.deconz, camera.amcrest, device_tracker.mobile_app
2021-05-11 23:05:17 DEBUG (MainThread) [aioesphomeapi.connection] 192.168.1.93: Got message of type <class 'api_pb2.ConnectResponse'>: 
2021-05-11 23:05:17 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [281473529230624] Sending {"id": 2, "type": "event", "event": {"event_type": "state_changed", "data": {"entity_id": "media_player.ultracast_bedroom", "old_state": {"entity_id": "media_player.ultracast_bedroom", "state": "unavailable", "attributes": {"friendly_name": "Ultracast Bedroom", "supported_features": 152449}, "last_changed": "2021-05-11T21:05:17.454290+00:00", "last_updated": "2021-05-11T21:05:17.454290+00:00", "context": {"id": "b2e95a68c3274fff9e402b24439fec60", "parent_id": null, "user_id": null}}, "new_state": {"entity_id": "media_player.ultracast_bedroom", "state": "off", "attributes": {"friendly_name": "Ultracast Bedroom", "supported_features": 152461}, "last_changed": "2021-05-11T21:05:17.980836+00:00", "last_updated": "2021-05-11T21:05:17.980836+00:00", "context": {"id": "5d8f151df0712d26ca31308606307e83", "parent_id": null, "user_id": null}}}, "origin": "LOCAL", "time_fired": "2021-05-11T21:05:17.980836+00:00", "context": {"id": "5d8f151df0712d26ca31308606307e83", "parent_id": null, "user_id": null}}}
2021-05-11 23:05:17 DEBUG (Thread-17) [pychromecast.socket_client] [(None):8009] connection listener: ffff9a046ca0 (CastStatusListener) ConnectionStatus(status='CONNECTING', address=NetworkAddress(address=None, port=8009))
2021-05-11 23:05:17 DEBUG (Thread-17) [homeassistant.components.cast.media_player] [media_player.bedroom_display Bedroom Display] Received cast device connection status: CONNECTING
2021-05-11 23:05:17 DEBUG (Thread-17) [pychromecast.dial] get_info_from_service resolved service ServiceInfo(type='mdns', data='Google-Nest-Hub-1951c793118fe9b7c821907a48a42ed1._googlecast._tcp.local.') to service_info ServiceInfo(type='_googlecast._tcp.local.', name='Google-Nest-Hub-1951c793118fe9b7c821907a48a42ed1._googlecast._tcp.local.', addresses=[b'\xc0\xa8\x01G'], port=8009, weight=0, priority=0, server='1951c793-118f-e9b7-c821-907a48a42ed1.local.', properties={b'id': b'1951c793118fe9b7c821907a48a42ed1', b'cd': b'87BE3FA9506216A9626E2C5A8B66F886', b'rm': b'5D0AFBCA4344906C', b've': b'05', b'md': b'Google Nest Hub', b'ic': b'/setup/icon.png', b'fn': b'Bedroom Display', b'ca': b'233477', b'st': b'0', b'bs': b'FA8FCA609DBA', b'nf': b'1', b'rs': b''})
2021-05-11 23:05:17 DEBUG (Thread-17) [pychromecast.socket_client] [Bedroom Display(None):8009] Resolved service ServiceInfo(type='mdns', data='Google-Nest-Hub-1951c793118fe9b7c821907a48a42ed1._googlecast._tcp.local.') to 192.168.1.71:8009
2021-05-11 23:05:17 DEBUG (Thread-17) [pychromecast.socket_client] [Bedroom Display(192.168.1.71):8009] Connecting to 192.168.1.71:8009
2021-05-11 23:05:17 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [281473384830864] Sending {"id": 2, "type": "event", "event": {"event_type": "state_changed", "data": {"entity_id": "media_player.ultracast_bedroom", "old_state": {"entity_id": "media_player.ultracast_bedroom", "state": "unavailable", "attributes": {"friendly_name": "Ultracast Bedroom", "supported_features": 152449}, "last_changed": "2021-05-11T21:05:17.454290+00:00", "last_updated": "2021-05-11T21:05:17.454290+00:00", "context": {"id": "b2e95a68c3274fff9e402b24439fec60", "parent_id": null, "user_id": null}}, "new_state": {"entity_id": "media_player.ultracast_bedroom", "state": "off", "attributes": {"friendly_name": "Ultracast Bedroom", "supported_features": 152461}, "last_changed": "2021-05-11T21:05:17.980836+00:00", "last_updated": "2021-05-11T21:05:17.980836+00:00", "context": {"id": "5d8f151df0712d26ca31308606307e83", "parent_id": null, "user_id": null}}}, "origin": "LOCAL", "time_fired": "2021-05-11T21:05:17.980836+00:00", "context": {"id": "5d8f151df0712d26ca31308606307e83", "parent_id": null, "user_id": null}}}
2021-05-11 23:05:18 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [281473529230624] Sending {"id": 2, "type": "event", "event": {"event_type": "state_changed", "data": {"entity_id": "sensor.living_room_camera_ptz_preset", "old_state": null, "new_state": {"entity_id": "sensor.living_room_camera_ptz_preset", "state": "4", "attributes": {"friendly_name": "Living room camera PTZ Preset", "icon": "mdi:camera-iris"}, "last_changed": "2021-05-11T21:05:17.986699+00:00", "last_updated": "2021-05-11T21:05:17.986699+00:00", "context": {"id": "b92419c1db45017dfa7003670cebf94d", "parent_id": null, "user_id": null}}}, "origin": "LOCAL", "time_fired": "2021-05-11T21:05:17.986699+00:00", "context": {"id": "b92419c1db45017dfa7003670cebf94d", "parent_id": null, "user_id": null}}}
2021-05-11 23:05:18 DEBUG (SyncWorker_1) [homeassistant.components.amcrest.sensor] Updating Kitchen camera PTZ Preset sensor
2021-05-11 23:05:18 DEBUG (SyncWorker_1) [amcrest.http] <Amcrest2:AMC00104161DE28N5K> HTTP query 5: http://192.168.1.78:80/cgi-bin/ptz.cgi?action=getPresets&channel=0
2021-05-11 23:05:18 DEBUG (SyncWorker_1) [amcrest.http] <Amcrest2:AMC00104161DE28N5K> Running query 5 attempt 1
2021-05-11 23:05:18 DEBUG (SyncWorker_13) [homeassistant.components.amcrest.binary_sensor] Updating Kitchen camera Motion Detected binary sensor
2021-05-11 23:05:18 DEBUG (SyncWorker_13) [amcrest.http] <Amcrest2:AMC00104161DE28N5K> HTTP query 6: http://192.168.1.78:80/cgi-bin/eventManager.cgi?action=getEventIndexes&code=VideoMotion
2021-05-11 23:05:18 DEBUG (SyncWorker_13) [amcrest.http] <Amcrest2:AMC00104161DE28N5K> Running query 6 attempt 1
2021-05-11 23:05:18 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [281473529230624] Sending {"id": 2, "type": "event", "event": {"event_type": "state_changed", "data": {"entity_id": "binary_sensor.living_room_camera_online", "old_state": null, "new_state": {"entity_id": "binary_sensor.living_room_camera_online", "state": "on", "attributes": {"friendly_name": "Living room camera Online", "device_class": "connectivity"}, "last_changed": "2021-05-11T21:05:17.987521+00:00", "last_updated": "2021-05-11T21:05:17.987521+00:00", "context": {"id": "07c21e71b81a025b48198c95a9b0710e", "parent_id": null, "user_id": null}}}, "origin": "LOCAL", "time_fired": "2021-05-11T21:05:17.987521+00:00", "context": {"id": "07c21e71b81a025b48198c95a9b0710e", "parent_id": null, "user_id": null}}}
2021-05-11 23:05:18 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [281473384830864] Sending {"id": 2, "type": "event", "event": {"event_type": "state_changed", "data": {"entity_id": "sensor.living_room_camera_ptz_preset", "old_state": null, "new_state": {"entity_id": "sensor.living_room_camera_ptz_preset", "state": "4", "attributes": {"friendly_name": "Living room camera PTZ Preset", "icon": "mdi:camera-iris"}, "last_changed": "2021-05-11T21:05:17.986699+00:00", "last_updated": "2021-05-11T21:05:17.986699+00:00", "context": {"id": "b92419c1db45017dfa7003670cebf94d", "parent_id": null, "user_id": null}}}, "origin": "LOCAL", "time_fired": "2021-05-11T21:05:17.986699+00:00", "context": {"id": "b92419c1db45017dfa7003670cebf94d", "parent_id": null, "user_id": null}}}
2021-05-11 23:05:18 DEBUG (Thread-17) [pychromecast.socket_client] [Bedroom Display(192.168.1.71):8009] connection listener: ffff9a046ca0 (CastStatusListener) ConnectionStatus(status='CONNECTED', address=NetworkAddress(address='192.168.1.71', port=8009))
2021-05-11 23:05:18 DEBUG (Thread-17) [homeassistant.components.cast.media_player] [media_player.bedroom_display Bedroom Display] Received cast device connection status: CONNECTED
2021-05-11 23:05:18 DEBUG (Thread-17) [homeassistant.components.cast.media_player] [media_player.bedroom_display Bedroom Display] Cast device availability changed: CONNECTED
2021-05-11 23:05:18 DEBUG (Thread-17) [pychromecast.controllers] Receiver:Updating status
2021-05-11 23:05:18 DEBUG (Thread-17) [pychromecast.socket_client] [Bedroom Display(192.168.1.71):8009] Sending: Message urn:x-cast:com.google.cast.tp.connection from sender-0 to receiver-0: {'type': 'CONNECT', 'origin': {}, 'userAgent': 'PyChromecast', 'senderInfo': {'sdkType': 2, 'version': '15.605.1.3', 'browserVersion': '44.0.2403.30', 'platform': 4, 'systemVersion': 'Macintosh; Intel Mac OS X10_10_3', 'connectionType': 1}}
2021-05-11 23:05:18 DEBUG (Thread-17) [pychromecast.socket_client] [Bedroom Display(192.168.1.71):8009] Sending: Message urn:x-cast:com.google.cast.receiver from sender-0 to receiver-0: {'type': 'GET_STATUS', 'requestId': 1}
2021-05-11 23:05:18 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [281473384830864] Sending {"id": 2, "type": "event", "event": {"event_type": "state_changed", "data": {"entity_id": "binary_sensor.living_room_camera_online", "old_state": null, "new_state": {"entity_id": "binary_sensor.living_room_camera_online", "state": "on", "attributes": {"friendly_name": "Living room camera Online", "device_class": "connectivity"}, "last_changed": "2021-05-11T21:05:17.987521+00:00", "last_updated": "2021-05-11T21:05:17.987521+00:00", "context": {"id": "07c21e71b81a025b48198c95a9b0710e", "parent_id": null, "user_id": null}}}, "origin": "LOCAL", "time_fired": "2021-05-11T21:05:17.987521+00:00", "context": {"id": "07c21e71b81a025b48198c95a9b0710e", "parent_id": null, "user_id": null}}}
2021-05-11 23:05:18 INFO (MainThread) [homeassistant.components.esphome] Successfully connected to 192.168.1.93
2021-05-11 23:05:18 DEBUG (Thread-17) [pychromecast.socket_client] [Bedroom Display(192.168.1.71):8009] Connected!
2021-05-11 23:05:18 DEBUG (Thread-17) [pychromecast.socket_client] Thread started...
2021-05-11 23:05:18 DEBUG (MainThread) [aioesphomeapi.connection] 192.168.1.93: Sending <class 'api_pb2.DeviceInfoRequest'>: 
2021-05-11 23:05:18 DEBUG (Thread-15) [pychromecast.socket_client] [Office Speaker(192.168.1.70):8009] connection listener: ffff977425e0 (CastStatusListener) ConnectionStatus(status='CONNECTED', address=NetworkAddress(address='192.168.1.70', port=8009))
2021-05-11 23:05:18 DEBUG (Thread-15) [homeassistant.components.cast.media_player] [media_player.office_speaker Office Speaker] Received cast device connection status: CONNECTED
2021-05-11 23:05:18 DEBUG (Thread-15) [homeassistant.components.cast.media_player] [media_player.office_speaker Office Speaker] Cast device availability changed: CONNECTED
2021-05-11 23:05:18 DEBUG (Thread-15) [pychromecast.controllers] Receiver:Updating status
2021-05-11 23:05:18 DEBUG (Thread-15) [pychromecast.socket_client] [Office Speaker(192.168.1.70):8009] Sending: Message urn:x-cast:com.google.cast.tp.connection from sender-0 to receiver-0: {'type': 'CONNECT', 'origin': {}, 'userAgent': 'PyChromecast', 'senderInfo': {'sdkType': 2, 'version': '15.605.1.3', 'browserVersion': '44.0.2403.30', 'platform': 4, 'systemVersion': 'Macintosh; Intel Mac OS X10_10_3', 'connectionType': 1}}
2021-05-11 23:05:18 DEBUG (Thread-15) [pychromecast.socket_client] [Office Speaker(192.168.1.70):8009] Sending: Message urn:x-cast:com.google.cast.receiver from sender-0 to receiver-0: {'type': 'GET_STATUS', 'requestId': 1}
2021-05-11 23:05:18 DEBUG (SyncWorker_9) [amcrest.http] <AMC000EW_KT531F:AMC000EWK7SWKT531F> Query 12 worked. Exit code: <200>
2021-05-11 23:05:18 DEBUG (SyncWorker_9) [amcrest.http] <AMC000EW_KT531F:AMC000EWK7SWKT531F> HTTP query 13: http://192.168.1.61:80/cgi-bin/configManager.cgi?action=getConfig&name=MotionDetect
2021-05-11 23:05:18 DEBUG (SyncWorker_9) [amcrest.http] <AMC000EW_KT531F:AMC000EWK7SWKT531F> Running query 13 attempt 1
2021-05-11 23:05:18 DEBUG (Thread-15) [pychromecast.socket_client] [Office Speaker(192.168.1.70):8009] Connected!
2021-05-11 23:05:18 DEBUG (Thread-15) [pychromecast.socket_client] Thread started...
2021-05-11 23:05:18 DEBUG (Thread-16) [pychromecast.socket_client] [Workshop Speaker(192.168.1.76):8009] connection listener: ffff97685280 (CastStatusListener) ConnectionStatus(status='CONNECTED', address=NetworkAddress(address='192.168.1.76', port=8009))
2021-05-11 23:05:18 DEBUG (Thread-16) [homeassistant.components.cast.media_player] [media_player.workshop_speaker Workshop Speaker] Received cast device connection status: CONNECTED
2021-05-11 23:05:18 DEBUG (Thread-16) [homeassistant.components.cast.media_player] [media_player.workshop_speaker Workshop Speaker] Cast device availability changed: CONNECTED
2021-05-11 23:05:18 DEBUG (Thread-16) [pychromecast.controllers] Receiver:Updating status
2021-05-11 23:05:18 ERROR (Thread-16) [homeassistant] Error doing job: Task was destroyed but it is pending!
2021-05-11 23:05:18 DEBUG (Thread-16) [pychromecast.socket_client] [Workshop Speaker(192.168.1.76):8009] Sending: Message urn:x-cast:com.google.cast.tp.connection from sender-0 to receiver-0: {'type': 'CONNECT', 'origin': {}, 'userAgent': 'PyChromecast', 'senderInfo': {'sdkType': 2, 'version': '15.605.1.3', 'browserVersion': '44.0.2403.30', 'platform': 4, 'systemVersion': 'Macintosh; Intel Mac OS X10_10_3', 'connectionType': 1}}
2021-05-11 23:05:18 DEBUG (Thread-15) [pychromecast.socket_client] [Office Speaker(192.168.1.70):8009] Received: Message urn:x-cast:com.google.cast.receiver from receiver-0 to sender-0: {'requestId': 1, 'status': {'userEq': {'high_shelf': {'frequency': 4500.0, 'gain_db': 0.0, 'quality': 0.707}, 'low_shelf': {'frequency': 150.0, 'gain_db': 0.0, 'quality': 0.707}, 'max_peaking_eqs': 0, 'peaking_eqs': []}, 'volume': {'controlType': 'master', 'level': 0.44999998807907104, 'muted': False, 'stepInterval': 0.019999999552965164}}, 'type': 'RECEIVER_STATUS'}
2021-05-11 23:05:18 DEBUG (Thread-15) [pychromecast.controllers] Received status: CastStatus(is_active_input=None, is_stand_by=None, volume_level=0.44999998807907104, volume_muted=False, app_id=None, display_name=None, namespaces=[], session_id=None, transport_id=None, status_text='', icon_url=None, volume_control_type='master')
2021-05-11 23:05:18 DEBUG (Thread-16) [pychromecast.socket_client] [Workshop Speaker(192.168.1.76):8009] Sending: Message urn:x-cast:com.google.cast.receiver from sender-0 to receiver-0: {'type': 'GET_STATUS', 'requestId': 1}
2021-05-11 23:05:18 DEBUG (Thread-16) [pychromecast.socket_client] [Workshop Speaker(192.168.1.76):8009] Connected!
2021-05-11 23:05:18 DEBUG (Thread-16) [pychromecast.socket_client] Thread started...

Additional information

I cannot see what it is that causes the issue. I have several Google Assistant devices. 7 to be exact

The ERROR is in an area of the log where HA inits connection to a Google Assistant box.

But is it related? I cannot see anything failing. It just spits out the single error in the middle of the log with nothing I can see that fails afterwards

EDIT. See discussion below. Issue seems related to the Harmony integration and not at all Google.

TheRealWaldo commented 3 years ago

Also seeing this error in my instances and haven't been able to track down or eliminate the cause.

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.

KennethLavrsen commented 3 years ago

This issue is still present. I cannot find anything wrong with my installation and yet this error message pops up each time I restart HA and always after all the integrations have finished loading.

I have tried the most verbatim log level but the message leaves no trace back to what triggers it.

lensherm commented 2 years ago

Add one more to the fold. Also having this issue with no apparent cause as of now.

casperse commented 2 years ago

Looks like I am a member of the same club :-( image

KennethLavrsen commented 2 years ago

I have not seen this error for a while. And it disappeared after I removed an Integration that I no longer needed. I replaced my Harmony Hub with a Broadlink locally controlled solution. I am pretty that was the change that I did that matches when this log error went away. Any of you me too’ers that has the Logitech Harmony integration running?

airdrummingfool commented 2 years ago

Any of you me too’ers that has the Logitech Harmony integration running?

👋

TheRealWaldo commented 2 years ago

Any of you me too’ers that has the Logitech Harmony integration running?

:wave:

balloob commented 2 years ago

If you enable the debug mode of the event loop, it should report where the task was created that was pending. You can enable debug mode by enabling the debugpy integration in configuration.yaml:

debugpy:
airdrummingfool commented 2 years ago

Looks like Harmony is confirmed. Here's what I found by enabling debugpy per Paulus' instructions:

2021-12-21 23:03:43 ERROR (MainThread) [homeassistant] Error doing job: Task was destroyed but it is pending!: File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/src/homeassistant/homeassistant/__main__.py", line 331, in <module>
sys.exit(main())
File "/usr/src/homeassistant/homeassistant/__main__.py", line 318, in main
exit_code = runner.run(runtime_conf)
File "/usr/src/homeassistant/homeassistant/runner.py", line 121, in run
return loop.run_until_complete(setup_and_run_hass(runtime_config))
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 629, in run_until_complete
self.run_forever()
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 596, in run_forever
self._run_once()
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1882, in _run_once
handle._run()
File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 313, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File "/usr/src/homeassistant/homeassistant/components/harmony/__init__.py", line 35, in async_setup_entry
await data.connect()
File "/usr/src/homeassistant/homeassistant/components/harmony/data.py", line 119, in connect
connected = await self._client.connect()
File "/usr/local/lib/python3.9/site-packages/aioharmony/harmonyapi.py", line 149, in connect
return await self._harmony_client.connect()
File "/usr/local/lib/python3.9/site-packages/aioharmony/harmonyclient.py", line 187, in connect
if not await self._hub_connection.hub_connect():
File "/usr/local/lib/python3.9/site-packages/aioharmony/hubconnector_xmpp.py", line 176, in hub_connect
super(HubConnector, self).connect(
File "/usr/local/lib/python3.9/site-packages/slixmpp/clientxmpp.py", line 174, in connect
return XMLStream.connect(self, address[0], address[1], use_ssl=use_ssl,
File "/usr/local/lib/python3.9/site-packages/slixmpp/xmlstream/xmlstream.py", line 291, in connect
self._run_out_filters = asyncio.ensure_future(
casperse commented 2 years ago

Yes running two Harmony Hubs so I would not be able to do without it....

KennethLavrsen commented 2 years ago

As a reporter I have no rights to label the report to the Harmony integration developer. We need a dev to do that.

It seems that all you need to reproduce is to add the Harmony integration, probably with a Harmony hub to connect to. The log entry comes within the first minutes after a HA restart and then never again so it is related to the initial run and/or connection.

I have removed my Harmony hardware completely so I will have to ask the other “me too” users to follow up if a dev decides to pick this up and have questions or need feedback on fix.

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

harmony documentation harmony source (message by IssueLinks)

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

Hey there @ehendrix23, @bramkragten, @bdraco, @mkeesey, @aohzan, mind taking a look at this issue as it has been labeled with an integration (harmony) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

audiofreak9 commented 2 years ago

Any of you me too’ers that has the Logitech Harmony integration running?

👋

jone9618 commented 2 years ago

I'm a new me too'er that has the Logitech harmony Hub integration running

jone9618 commented 2 years ago

I can also confirm that if I disable the harmony integration and restart HA the error does not appear in the log

bdraco commented 2 years ago

If you turn off xmpp support on the hub, it should avoid using the xml library and the problem should go away.

We previously advised to enable xmpp support since we were worried websocket support might go away, but since logi has discoed harmony, I don't think thats a concern anymore.

nbetcher commented 2 years ago

@bdraco As far as I can tell -- including some posts that explicitly state this is NOT the case -- Harmony Hub itself was not discontinued and Logitech has stated they will even keep making the Harmony Hub, just not the remotes. Do you have any source of the statement that the Hub has been discontinued? Or were you speaking about the remotes?

bdraco commented 2 years ago

https://gizmodo.com/logitech-kills-harmony-universal-remotes-says-it-will-1846660033/amp

The hub is listed as out of stock on their website, and new ones don't seem to be available for purchase anywhere. Only refurbs and secondary market options seem available

If they don't intend to discontinue the hub they are doing a poor job of producing and stocking it.

nbetcher commented 2 years ago

@bdraco Taken from many sites, the following was stated by Logitech:

Is The Harmony Hub Discontinued?

In a recent announcement, Logitech announced it would discontinue production of its Harmony universal remotes, including the Harmony Pro Hub.

(from https://www.nstec.com/how-long-does-it-take-to-update-harmony-hub-software/)

The Pro Hub and the non-Pro hub are not the same. It appears the major difference is the number of 3.5mm plugins for external IR transceivers: Pro Hub has 6 of them, the non-pro only has 2.

Pro Hub FCC filing: https://apps.fcc.gov/eas/GetApplicationAttachment.html?id=4277373 (skip to page 13) Non-Pro Hub FCC filing: https://apps.fcc.gov/eas/GetApplicationAttachment.html?id=1930873 (diagram of back of Hub is shown under the step labeled "2."

I have been unable to find any references anywhere about the non-Pro Hub being discontinued. As for the shortage of supply, that's not surprising at all considering the world is currently going through a silicon chip crisis -- and labor shortage, in the US. Many, many products from all industries are not currently available.

While it's entirely possible that the Logitech [non-Pro] Hub will be killed, at the moment that does not appear to be the case, according to Logitech [inferred]. Hopefully this is a help and steers the Home Assistant integration for it in the right direction, whatever direction that may be. :)

github-actions[bot] commented 2 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.

audiofreak9 commented 2 years ago

This error no longer exists for me.

MEKadan commented 1 year ago

Hi,

I have never even heard about Logitech Harmony, but I started to get these after update to 2022.10. Looks like it (probably) has something to do with History stats?

EDIT: Copied a wrong error message here accidentally. Removed and posted the correct one(s) There are actually 2 similar messages, only difference is, that the error seems to be generated in different line of the python script

Logger: homeassistant Source: runner.py:96 First occurred: 05:45:39 (114 occurrences) Last logged: 13:59:30 Error doing job: Task was destroyed but it is pending!

Logger: homeassistant Source: runner.py:119 First occurred: 07:31:54 (54 occurrences) Last logged: 12:28:54 Error doing job: Task was destroyed but it is pending!

realthk commented 1 year ago

Same here since 2022.10, also without Logitech Harmony. Not too frequent, but there are a few messages every day in the log:

2022-10-10 08:39:13.220 ERROR (MainThread) [homeassistant] Error doing job: Task was destroyed but it is pending!
2022-10-10 15:50:25.532 ERROR (Recorder) [homeassistant] Error doing job: Task was destroyed but it is pending!
2022-10-10 17:37:25.370 ERROR (SyncWorker_7) [homeassistant] Error doing job: Task was destroyed but it is pending!
erkr commented 1 year ago

If you turn off xmpp support on the hub, it should avoid using the xml library and the problem should go away.

I don’t have enabled xmpp, but still have these task destroyed errors now and then.

bdraco commented 1 year ago

Enable debugpy and you’ll get the full trace to tell exactly where it’s coming from

erkr commented 1 year ago

I only have them sporadically, but will try to catch them with debugpy

issue-triage-workflows[bot] commented 1 year 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.

MEKadan commented 1 year ago

The error s have gone nowhere, still getting them sporadically.

Today 2 of these:

`Logger: homeassistant Source: runner.py:97 First occurred: 07:39:49 (2 occurrences) Last logged: 07:41:10

Error doing job: Task was destroyed but it is pending!`

and 3 of these:

`Logger: homeassistant Source: runner.py:120 First occurred: 07:43:17 (3 occurrences) Last logged: 07:49:22

Error doing job: Task was destroyed but it is pending!`

No harmony hub.

RaspPi 4 B eGB + SSD, Conbee II, Home Assistant 2023.1.7, Supervisor 2023.01.1, Operating System 9.5, Frontend 20230110.0 - latest

issue-triage-workflows[bot] commented 1 year 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.

bdraco commented 1 year ago

https://github.com/ehendrix23/aioharmony/blob/31561ebce43f5e8933809c2f4778e352a54298f6/aioharmony/helpers.py#L114

The problem is likely there

https://docs.python.org/3/library/asyncio-task.html#creating-tasks

Important Save a reference to the result of this function, to avoid a task disappearing mid-execution. The event loop only keeps weak references to tasks. A task that isn’t referenced elsewhere may get garbage collected at any time, even before it’s done. For reliable “fire-and-forget” background tasks, gather them in a collection:

issue-triage-workflows[bot] commented 1 year 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.

issue-triage-workflows[bot] commented 10 months 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.

KennethLavrsen commented 10 months ago

Since there is pending PR I ping the bot even though I tossed my harmony ages ago.

issue-triage-workflows[bot] commented 7 months 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.