stale data display race condition during track cache expiration

Bug #1392557 reported by RJ Skerry-Ryan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mixxx
Fix Released
Low
RJ Skerry-Ryan

Bug Description

In some circumstances the library can show stale data for a track in the time between a TrackPointer expiring and being saved to the database. Here's the rough series of steps that leads to this:

BaseTrackCache contains stale data, TrackPointer has modified data
1) Track N+cacheSize Loaded
2) TrackDAO QCache expires TrackPointer N -- TrackPointer reference count drops to zero
3) TrackPointer destructor called -- calls QObject::deleteLater (or whatever we use)

From this point on we are serving stale results for the track out of BaseTrackCache since TrackDAO will not serve Track N out of the cache (the TrackPointer has already been deleted and it is pending a database write). TrackDAO's weak reference cache (m_sTracks) will not convert to a TrackPointer since its strong reference is gone.

4) At some point, a library update re-draws the cell for the row for track N. RENDERING STALE DATA
5) QObject::deleteLater runs, deletes the TIO. ~TrackInfoObject runs, signals to TrackDAO to save.
6) TrackDAO saves the track, sets the track clean.
7) TrackN signals clean, BaseTrackCache runs updateIndexForTrackId(track n)
8) BaseTrackCache trackChanged signal hits BaseSqlTableModel, which emits row-redraw calls for affected rows
9) Library table redraws affected cells, drawing up to date data

Tags: library
RJ Skerry-Ryan (rryan)
Changed in mixxx:
milestone: none → 1.12.0
assignee: nobody → RJ Ryan (rryan)
importance: Undecided → Low
status: New → In Progress
tags: added: library
summary: - stale data display race condition in track cache expiration
+ stale data display race condition during track cache expiration
Revision history for this message
Owen Williams (ywwg) wrote :

did we fix this?

Revision history for this message
RJ Skerry-Ryan (rryan) wrote :
Changed in mixxx:
status: In Progress → Fix Committed
RJ Skerry-Ryan (rryan)
Changed in mixxx:
status: Fix Committed → Fix Released
Revision history for this message
Swiftb0y (swiftb0y) wrote :

Mixxx now uses GitHub for bug tracking. This bug has been migrated to:
https://github.com/mixxxdj/mixxx/issues/7649

lock status: Metadata changes locked and limited to project staff
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.