alexa_media_player: Version v4.13.3 is making HA fail
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
I installed v4.13.3 and shortly after my HA kept loosing connection. I would re boot, it would work fine for a few minutes, then it would disconect.
To Reproduce
I used a full backup for HA for Sept 30th. Before the Alexa update I did a core update, assumed that caused the issue. Once I restored I didn’t do the core update but did do the Alexa update. Few minutes later issue of disconnect started again.
Restored the Sept 30th backup again. This time I did the HA core update, but skipped the v4.13.3 update for Alexa. My HA has been stable for over 30 minutes now.
- Go to ‘…’
- Click on ‘…’
- Scroll down to ‘…’
- See error
Expected behavior
I would expect to install v4.13.3 and not have my HA system crash.
Screenshots
No screen shots
System details
- Home Assistant version: Running HA via proxmox server. Updated to the last version
- alexa_media version (from
const.pyor HA startup log): Stable version 4.13.2 - alexapy version (from
pip show alexapyin homeasssistant container or HA startup log): - Is Amazon 2FA/2SV enabled <!—We will not debug login issues if unanswered—> (y/n):
- Amazon Domain:
Debug Logs (alexa_media & alexapy) Please provide logs.
Additional context
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 137
- Comments: 154 (20 by maintainers)
Commits related to this issue
- fix: Fixes issue #2579 ### Summary of the CPU Issue and Solution **Problem:** The implementation with **parallel loading** of Alexa components caused high CPU usage. Multiple components were lo... — committed to jleinenbach/alexa_media_player by jleinenbach 2 years ago
- [hass] revert memory increase - cause of issue found: https://github.com/alandtse/alexa_media_player/issues/2579 — committed to adampetrovic/home-ops by adampetrovic 2 years ago
- fix: fix infinite loop and memory exhaustion (#2589) closes #2579 — committed to alandtse/alexa_media_player by dpwood 2 years ago
@lviciedo HOW DARE YOU! FYI, there is no longer a developer, or a team!
And poor you that you wasted 2 hours! That’s only 1/100 of the time I’ve devoted in the last 4 months trying to keep this integration alive. That’s $10,000 of my time that I’ve given back, for free! If you can’t afford to waste 2 hours, why are you using free software. Invest in a commercial product where you have a right to complain!
Yes in HACS, click on the 3 dots --> download again and then select the old version.
Dont forget to restart HA afterwards.
Do it by yourself or PAY someone to do something. But never ever criticise people which working for free for your stuff!
Same Issue - had to full restore HAS and wasted 2 hours of my life. Alan & the Alexa Media team… Thank you for all you do BUT… DO BETTER!
I’m sorry sorry you all have this issue. I’m glad I saw a post about his in HA Facebook group.
But please understand the Alexa integration is a open source app. That has been life support for the past few months. For the original code owner is not working on it.
Some awesome volunteers have been working on it to get caught up with updating to the new Home assistant standards. This is a free app not coming from a commercial company. So have some understanding and patience.
After reading this I just wanted to stop by and say a BIG THANK YOU to @danielbrunt57! I appreciate every single second of the time you’ve put in working on this integration. You are an absolute gentlemen sir! This integration is wonderful and a much enjoyed part of my Home Assistant setup.
You are free not to use the integration, it is not mandatory. As someone said before, if I was paying for this I might criticize, but this is free! This is coming from someone who also wasted 2 hours on this.
Same problem here HA restarts every 5min or when you give any commands to HA.
Rollback to 4.13.2 solves the issue.
The issue is NOT related to 2024.10.0 I am still on 2024.09.03 and have the problem.
I highly recommend to completely restart (including OS) after the rollback to version 4.13.2. Otherwise you will still have a higher cpu and memory load than normal.
Please remove the new version as soon as possible, many people are left without access to their Home Assistant
OUT OF MEMORY error and HA reboots every 5 minutes. Now I disabled the integration; I hope is enough.
yes this updates make my system ERROR dont install this update!!!
This is b
I suggest to just immediately disable the alexa-media-player integration so you’ve time to roll back to the older version
Cheers mate
Having the same issue! Had to reboot in safe mode (which took a few trials) and deactivate the integration.
It seems like then installing the old version makes HA stable again.
Please do not spam the thread! Comments like “same here” or “works after rollback” do not add anything new to the case.
I, too, found my HA crashing repeatedly due to the bug. But I’m not here complaining at the devs who put in their hard work for free. Especially for a HACS integration, which explicitly comes with a level of potential instability or risk that you must accept when installing it. I installed the latest version without waiting, without seeing how other people fared with it, and predictably that made me a Guinea pig. If you don’t want to be a Guinea pig, if you don’t want to be subject to these sorts of bugs, don’t install updates right away. In fact, maybe HACS just isn’t for you. Don’t come here bitching at the devs that put their metaphorical blood, sweat, and tears into free software for you.
I have the same big issue. HA goes to 100% CPU and begins to eat all the RAM. System unusable after few seconds. No time enough to downgrade AMP.
You are absolutely right, in every single word. I really appreciate your work and dedication. Please feel encouraged to further keep this integration alive. Don‘t give a cent on comments of this ungrateful fools which don‘t understand volunteership. It also took me some time to figure out which integration messes up, but thats not your fault but rather mine or the not to easy to read logs from homeassistant.
Same here, --downgraded Alexa to 4.13.2
Version 4.13.3 should be retracted immediately. Was wondering too why my HA kept crashing after updating all my HACS integrations.
This is how I downgraded to the previous version. I was able to do this between reboots if I caught it fast enough.
Go to HACS and choose Alexa Media Player Press 3 button menu in upper right hand corner Select - Redownload Choose - Need different version? Select 4.13.2 download and restart home assistant
When update available comes up for Alexa media player 4.13.3 press it and choose skip to hide that version
It appears they have pulled 4.13.3.
Spent last hour looking why my HA keep crashing every 20 minutes after updated it to 2024.10… I found then this issue!
FYI, everyone saying they were on 14.3.2 and downgraded, and it started working… that’s not what is really happening.
You installed 14.3.3, the release was then pulled, you went and checked hacs and it showed you 14.3.2 even though 14.3.3 was still installed on your system. You then installed 14.3.1 or some other version and everything started working. I’ve helped about 10 people today who ran into this exact sequence of events.
If you updated yesterday, you cannot trust the version in the HACS store. You can only trust the version listed in developer tools -> states page when looking at the
update.alexa_media_player_updateentity.Before discovering the memory leak issue, I updated Alexa Media Player to v4.13.3, but I haven’t restarted Home Assistant yet. Home Assistant is still running fine. I’m using Home Assistant 2024.9.3 (I haven’t upgraded to 2024.10.0) on a Raspberry Pi 4, 64-bit, with 4GB of RAM. Given the situation, what would be the best course of action?
Edit: After quickly reviewing this thread, I realised that the best course of action might be to roll back to v4.13.2 by selecting ‘
🔁 Redownload’ and choosing versionv4.13.2in HACS.@Starf0x It seems the main issue is that there isn’t a dedicated “developer” at the moment. The guy that started it is not working on it anymore. From what I’ve read there is a bunch of random people trying to keep it working but no one has taken “ownership” of the program. I’ve read some comments of folks talking smack about the developers (not implying you are one of those) but at this time who ever is trying to keep it alive is doing it out of their kindness.
Crazy the world we live in where often people expert “more” from free stuff.
Experienced same issue, fixed by downgrading. This should be revoked to prevent others suffering the same issue.
Same, issue HA unavailabe after a few minute. Managed to roll back to v4.13.2
There’s already a PR which fixes it.
One line code change:
https://github.com/alandtse/alexa_media_player/pull/2589/files
Would be helpful if others would try it, and confirm this resolves it for them too.
This is the way.
So I could not get the UI to load at all… My raspberry pi just failed to boot HA’s UI after this update. So to get into safe mode I plugged a HDMI mini into the Pi and a keyboard, used the on screen console and manged to run
core restart --safe-modeIt took a few command attempts, but it did reboot into safe mode and I manged to disable the alexa integration.
For those looking to get out of the boot loop, the fastest way I found was to unplug my device and plug it back in, and sit refreshing this page: http://{local-ip-for-ha}:8123/config/integrations/integration/alexa_media
Then as soon as it’s available, before the integration has had time to load, click the three dots next to the Alexa Media Player entry and hit disable, since the SSH add-on often won’t have launched yet to give you other options before the hardware runs out of resources and stops functioning.
If it’s just not happening, you might be able to change your Amazon account password/turn on/off 2FA or reset your 2FA device and that may keep the integration from authing in the first place which might kick you out of the boot loop.
Some feedback on this : I have HA 2024.9.3 with v4.13.3. Same problem, one reboot every 15 minutes.
I applied the one line fix #2589. Seems stable again, no reboot since.
If you’ve come here to say “ME TOO”:
There is a proposed fix, it is a simple change to one file. This integration is maintained by volunteers, so please help them by trying the fix rather than just disabling the integration. I can tell you it has worked for me.
https://github.com/alandtse/alexa_media_player/pull/2589/files
It appears to be specific to certain devices, so a community effort here would get the fix verified more quickly. The code maintainers obviously don’t have the affected devices.
I had the same issue. I started HA in safe mode and disabled the integration. Since I was only using for Alexa voice notifications I decided not to use it going forward. My solution is to use helpers and pass the value to Alexa. When the value is on I have Alexa play the message. When I have HA Voice setup I will use that. I eventually want to move away from Amazon altogether.
Extending a list whilst iterating it. This will infinite loop and endlessly grow the list until it eats all memory and crashes.
custom_components/alexa_media/helpers.py:245
Simple fix is to change the iterator to operate on a copy:
for serial in existing_serials[:]:Have tested it and now have a slightly modified 4.13.3 running with no problems. PR follows.
All true and very much appreciated. However the reboots of Home Assistant are the most serious issue with an integration I have ever had.
Seems it would be wise to quickly remove 4.13.3
Same for me - seems to be stable for at least an hour
I had some mixed results earlier today, but I just rebooted again with the one line change and all seems well.
I also added a log within the loop to output the
devicevariable, and I get just 1 log for each of my devices each time the loop is executed. So it seems to be a good fix, at least for me.Did the one line change in the helper.py file. It’s working without any issues since last 4 hours. No crashing any more.On Oct 5, 2024, at 2:50 PM, Petro31 @.***> wrote:
Not likely is it?
There’s already a PR which fixes it.
One line code change:
https://github.com/alandtse/alexa_media_player/pull/2589/files
Would be helpful if others would try it, and confirm this resolves it for them too.
I do not see how that PR would fix the infinite loop. Adding [:] to a list keeps the list identical and that’s the only change in the PR.
e.g.
items = [‘a’,‘b’]
for item in items:
…
is identical to
items = [‘a’,‘b’]
for item in items[:]:
…
I think we have too many people relying on AI to submit PRs on this.
It’s not the same. The [:] means it’s going to be iterating over a copy of the list and that’s the critical difference. This is not an AI fix. I found it myself by analysis and testing. I do however share your wider concern. If you mean the original code is misusing HA by doing blocking calls then you’re right, but that’s a separate issue, or have I misunderstood what you meant?
Yes I meant the original PR. And yes I amended my comment about it being the same.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>
https://github.com/alandtse/alexa_media_player/pull/2589/files
Yes I meant the original PR. And yes I amended my comment about it being the same.
First have you subscribed to Nabu Kasa cloud. This gives the HA voice assistant connections to Amazon Alexa for devices. (Not part of media player) but part of HA. Second I created an input Boolean toggle helper from within devices and services. Then I exposed it to the Alexa voice assistant this will now be a toggle switch usable in both HA and Alexa. Then create your automation to turn on the toggle. Example I turn it on when the washer starts and off when it is done. (Using power from a smart energy plug. In Alexa I created a routine when the switch goes to off it will say a message on the selected device. On Oct 4, 2024, at 12:42 PM, florismetzner @.***> wrote: I’m really interested how to do the voice notifications in such a way… That’s the only thing I need
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>
Can confirm memory leak crashing home assistant on virtual machine
rollback this update asap! mahine was non stop crashing.
I did this, yes. I also have a HA-Blue. Not 100% sure if it helped on a technical level, but it made me feel better!
if the problem comes from Alexa media player hacs 4.13.3 is it possible to remove the update ?
On my RPi4 this update is still available.
A better approach would be to have a virtual machine with snapshots. Fortunately, I use this approach and make a snapshot before I run any update so it’s always easy to roll back
Same here. OutOfMemory every couple of minutes and HA reboot. AMP v4.13.3 HA: 2024.9.3
Did a rollback to AMP v4.13.2
I’ve had
v4.13.2running for about an hour now on HASS2024.10.0and all good. So definitely related to thev4.13.3release.This is definitely true, I can confirm this. Running HA as a virtual machine on a Synology NAS I had to ramp up the VMs memory to be fast enough to react inside HA.
Can confirm, do not pull the trigger on this update : o
Core 2024.10.0 Supervisor 2024.09.1 Operating System 13.1 Frontend 20241002.2
@ChristophCaina The update just came out a few hours ago. One solution for now is to “deactivate” Alexa Media Player, but other solution would be to roll back to the previous version of AMP which is still working fine.
thanks for that information. Seems that this is still ongoing and caused issues with 2024.10.0
Alexa MediaPlayer is now deactivated…
HA seems to hang as soon as this integration receives an event from Alexa. With debug logging enabled one of the last log messages is:
I’m able to reproduce this either by opening the Alexa app or by saying “Alexa, what’s the time?”