alexa_media_player
alexa_media_player copied to clipboard
2024.3 beta exception in logs, integration still works but the issue holds up the startup process by about 12 seconds.
IMPORTANT: Please search the issues, including closed issues, and the FAQ before opening a new issue. The template is mandatory; failure to use it will result in issue closure.
Describe the bug
New exception in logs.
To Reproduce
install beta, run beta.
Expected behavior
no exception in logs
Screenshots
System details
- Home-assistant (version): 2024.3.0b0
- alexa_media (version from
const.py
or HA startup): 4.9.2 - alexapy (version from
pip show alexapy
or HA startup): 1.27.10 - Amazon 2FA is enabled (y/n). <!---We will not debug login issues if unanswered--->: y
Logs Please provide logs.
2024-02-28 17:18:50.632 DEBUG (MainThread) [custom_components.alexa_media] Nothing to import from configuration.yaml, loading from Integrations
2024-02-28 17:18:51.506 INFO (MainThread) [custom_components.alexa_media]
-------------------------------------------------------------------
alexa_media
Version: 4.9.2
This is a custom component
If you have any issues with this you need to open an issue here:
https://github.com/alandtse/alexa_media_player/issues
-------------------------------------------------------------------
Had to remove center chunk to post, over character limit. Error below
2024-02-28 17:19:09.287 DEBUG (MainThread) [custom_components.alexa_media.sensor] <REMOVED>: Found 6****************************5cb Reminder sensor (0) with next: None
2024-02-28 17:19:09.287 DEBUG (MainThread) [custom_components.alexa_media.helpers] <REMOVED>: Adding [<entity unknown.unknown=unknown>, <entity unknown.unknown=unknown>, <entity unknown.unknown=unknown>, <entity unknown.unknown=unknown>, <entity unknown.unknown=unknown>, <entity unknown.unknown=unknown>, <entity unknown.unknown=unknown>, <entity unknown.unknown=unknown>, <entity unknown.unknown=unknown>, <entity unknown.unknown=unknown>, <entity unknown.unknown=unknown>, <entity unknown.unknown=unknown>, <entity unknown.unknown=unknown>, <entity unknown.unknown=unknown>, <entity unknown.unknown=unknown>, <entity unknown.unknown=unknown>, <entity unknown.unknown=unknown>, <entity unknown.unknown=unknown>, <entity unknown.unknown=unknown>, <entity unknown.unknown=unknown>, <entity unknown.unknown=unknown>, <entity unknown.unknown=unknown>, <entity unknown.unknown=unknown>, <entity unknown.unknown=unknown>]
2024-02-28 17:19:09.290 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up alexa_media platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 358, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 630, in async_add_entities
or not any(entity.should_poll for entity in entities)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 630, in <genexpr>
or not any(entity.should_poll for entity in entities)
^^^^^^^^^^^^^^^^^^
File "/config/custom_components/alexa_media/sensor.py", line 591, in should_poll
return not (self.hass.data[DATA_ALEXAMEDIA]["accounts"][self._account]["http2"])
^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'data'
Additional context
Let me know if you need more logs. I can post the center chunk via a file.
I have most things disabled, only have the media_players enabled. Not sure how self.hass is none at that point, haven't looked into the code.
Remove and readd. If self.hass is missing, everything is broken.
I'm 90% sure this is a thread safety issue after the hass startup updates. I think this should be reopened and investigated.
Again, if self.hass is none, there are issues outside of the component causing it. HA populates self.hass for all integrations. We assume HA will complete this.
You're welcome to diagnose on your system and submit a PR once you figure it out, but since I don't have a system with this problem and it's a violation of a HA guarantee, I won't be working on it.
I've also seen the exact same error.
Not happening at every boot but I've seen it more than once. And I'm having random issues with Alexa that I'm figuring it out to open an issue.
Having the same issue. There is also a duplicate issue here: https://github.com/alandtse/alexa_media_player/issues/2221 that is reporting the same issue with HA 2024.3.3.
I am also still seeing this on HA 2024.4.0
Well, I'm likely not going to look into it even though it's assigned to me. It's most likely a threading issue and I'd need to dive deep into this codebase in order to see if/where thread locks are not applied properly. Unfortunately, I know very little about this integration.
The startup changes that bdraco applied to HA to decrease startup time greatly impacts integration loading. Bdraco mentioned that things like this would occur in custom integrations, and that we should report this to the custom integration.
And as Alan said, nothing should be working if hass is None. But this is a strong indication of poor thread safety because most of the integration loads properly and uses the hass object.
Heck, it could be solved by simply fixing the current deprecation of async_add_job
.
I have the exact same error message - but on HA 2024.3.3. I haven't updated to 2024.4.x
same here. in 2023.3
Same with 2024.4.1
This , for me, has disappeared from the log when I restart HA. I can't remember when but on 2024.4.3 it is not there. Maybe when HAOS was updated recently? So warning gone - happy
This , for me, has disappeared from the log when I restart HA. I can't remember when but on 2024.4.3 it is not there. Maybe when HAOS was updated recently? So warning gone - happy
Yes, BDraco reviewed the code here and found some oddities with the entity creation process, specifically async_update
is called within async_added_to_hass
, which it shouldn't do. We didn't really dive in deep to why this was done in this integration. Instead a fix in HA was made to avoid checking for polling when the entity fails to add: https://github.com/home-assistant/core/pull/115159
This can probably be closed. Just keep in mind that the entity that's generating this error won't exist, which is a genuine bug in alexa media player.
see previous comment.