music-assistant / hass-music-assistant

Turn your Home Assistant instance into a jukebox, hassle free streaming of your favorite media to Home Assistant media players.
Apache License 2.0
1.2k stars 43 forks source link

Some players remain after deleting player provider #2494

Open madbrain76 opened 1 week ago

madbrain76 commented 1 week ago

What version of Music Assistant has the issue?

2.0.7

What version of the Home Assistant Integration have you got installed?

2024.6.2

Have you tried everything in the Troubleshooting FAQ and reviewed the Open and Closed Issues and Discussions to resolve this yourself?

The problem

Some DLNA players still remain after deleting the DLNA/UPNP player provider

How to reproduce

I don't have a very specific test case for this, but I have seen this behavior on multiple occasions in the past. Today, I was playing around with DLNA renders from JRiver and BubbleUPNP, to try to get MA to play audio on my PC and my Android phone respectively. It went something like this.

  1. install DLNA/UPNP player provider
  2. try to play content on JRiver DLNA provider (it failed)
  3. try to play content on BubbleUPNP DLNA provider (it failed, differently)
  4. delete DLNA player provider
  5. observe that 3 players remain

image

Music Providers

File system (network)

Player Providers

DLNA/UPNP

Full log output

log.txt

Additional information

What version of Home Assistant Core are your running

2024.6.2

What type of installation are you running?

Home Assistant OS

On what type of hardware are you running?

Windows

madbrain76 commented 1 week ago

Turns out it's not just the DLNA player provider. I just saw this with Airplay providers being left over as well. So, I have updated the description of this bug.

I just played with adding/disabling/removing the providers, and this time got quite a long list of Airplay and DLNA players left over. I probably would have Chromecast remaining as well, if I had added that provider, I just haven't tried.

image

Interestingly, the Airplay players hat remain are all in the disabled state (hourglass showing), but the DLNA players show as being available. While that might be considered a separate problem, it wouldn't happen at all if all players were properly removed when the corresponding player providers are.

The behavior is not exactly the same between every deletion attempt. It may be some sort of race condition. I'm doing the provider deletion very quickly, one after the other in a matter of seconds. Also, disabling the providers before deleting them seems to significantly increase the odds of reproducing the issue. So, I'm updating the test case.

  1. start with no player providers, and with the FS music provider (remote) installed, but disabled. I'm not sure if the state of the music provider has an impact on this or not, just listing what I used.
  2. add airplay player provider
  3. add DLNA/UPNP player provider
  4. wait for all players to show in the player list in the settings
  5. disable both player providers
  6. wait for all players to show as disabled in the player list
  7. quickly delete both player providers, with as little time in between as possible
  8. go to the player list in the settings
  9. some inconsistent number of players - from 0 to all of them - will remain, but not quite the same every time the test case is repeated. Some players may be shown in the disabled state (hourglass), while others lack the hourglass.

The only thing that consistently works to fix this is to delete all the remaining players one by one. When trying to fix it by adding the providers back, the behavior is inconsistent. Once in that messed state with the remaining players, MA behavior appears to be unpredictable. It all stems from that invalid state, and I don't know if it's worth reporting separate issues, as they would all disappear if this one is resolved, but I'll list some of what happens anyway.

  1. add the airplay and DLNA/UPNP providers back
  2. the player list shows that none of the players are in the disabled state. The only context menu option available is "delete"
  3. I tried re-enabling the FS music provider, as I had previously disabled it. I got an SMB error.
  4. I tried adding the Qobuz provider also, and got an authentication error
  5. I tried adding the Plex provider as well, and got a big red dialog with a long stack, but it was too short to capture
  6. I did steps 12/13/14 to see if I could play content on one of those remaining "ghost" players that can only be deleted, but I didn't get that far. After getting to the state in step 9, the state of MA is really odd, and hopefully, eliminating that state will get rid of all these subsequent problems

log.txt