Tracks are duplicated when the app restarts

Bug #1511313 reported by Alfonso Sanchez-Beato on 2015-10-29
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu Music App
Undecided
Andrew Hayzen

Bug Description

The list of tracks that is passed to media-hub contains duplicated elements. To reproduce:

1. Start music-app
2. Create a list, simply going to "Songs". Issue the command:

dbus-send --print-reply --type=method_call --dest=core.ubuntu.media.Service /core/ubuntu/media/Service/sessions/[X]/TrackList org.freedesktop.DBus.Properties.Get string:org.mpris.MediaPlayer2.TrackList string:Tracks

(substitute X with the session number that music app has created; to check which one the session is do "grep Session ~/.cache/upstart/media-hub.log")

to know the current tracks.

3. Play a song
4. Stop music-app
5. Reboot the phone
6. Start music-app and go to "Songs". Issue the the same command as in step 2.

Compare the output in both cases. The number of tracks is twice the one in step 2. media-hub log inspection shows duplicated entries. This does not look like a media-hub/qtubuntu-media issue as the track list seems to have been stored in disk: the reboot ensures that, although it is not actually needed to reproduce the error (you just need to re-start music-app).

Finally, when playing again the track list is re-created and you get the expected number of tracks, but the initial track list keeps growing and growing.

*** Taking a look at the music-app DB confirms that it is storing duplicated tracks:

sqlite3 ~/.local/share/com.ubuntu.music/Databases/b01631344d4b1a36d6dec3179aff8784.sqlite

sqlite> .dump queue
(lots of tracks here...)

Each start of music app + pressing play add rows that are duplicated. Finally, removing the database makes things start from scratch.

Although the list is recreated right when starting to play (so there are o immediate issues from the user's POV), iterating a few times causes performance to drop, as it starts to take a few seconds since the moment you press play to the moment when the displayed screen in music-app changes.

description: updated
description: updated
description: updated

Sounds like the clearQueue method is not being called correctly, or the clear of the playlist queue isn't working, is the queue in the UI always correct or does that have duplicates as well?

summary: - Tracks are duplicated when the app re-starts
+ [bgplaylist] Tracks are duplicated when the app re-starts
Changed in music-app:
assignee: nobody → Andrew Hayzen (ahayzen)

The queue in the UI is always right. What I think is happening:

1. music-app gets the tracks from the DB
2. It creates a track list in media-hub with them
3. When "play" is pressed, it clears the current track list and loads a new one in media-hub, this time a correct one
4. but it also appends those tracks to the table in the DB, increasing the number of tracks loaded initially when music-app re-starts

The side issue is that as the table grows, there is some lag in the app due to the time it takes to create/clear the initial playlist.

To solve this I guess that the tracks of step 4 should overwrite what is in the DB instead of being appended.

Jim Hodapp (jhodapp) on 2015-10-29
description: updated
description: updated
description: updated
Jim Hodapp (jhodapp) on 2015-10-29
tags: added: bgplaylist
summary: - [bgplaylist] Tracks are duplicated when the app re-starts
+ Tracks are duplicated when the app restarts

This might have been a false positive, as it stopped happening when I copied over my compiled media-hub library. So some ABI mess was happening.

Changed in music-app:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers