FS#8710 - "Gather Runtime Data" creates problems if "Load to RAM" is disabled

Attached to Project: Rockbox
Opened by Marcel Barbulescu (marcelbarbulescu) - Sunday, 09 March 2008, 23:48 GMT
Last edited by Bertrik Sikken (bertrik) - Monday, 19 July 2010, 09:57 GMT
Task Type Bugs
Category Database
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


When "Gather Runtime Data" and "Load to RAM" are disabled, any operation that modifies the runtime data (e.g. play) that is followed by a database display can produce unexpected results.

- while in WPS press Select, go to Database/Albums, select a song from an album, long press Select for context menu and go to Playlist/Insert; after the song is inserted the current database album is displayed with no tracks or am incomplete number of tracks
- browse the Database/Albums, select a song from an album and press Select two times very fast so it starts playing it and returns back to the Album song list; if the operation is fast enough the song list will be empty or incomplete

It can be reproduced on Sansa e200, Gigabeat and on the e200 Simulator.

From my investigation is probably related to reading the database files while another thread writes the updated runtime data into them. tagcache.c:get_next can return bad data if an update to the runtime data was just performed and a write is in progress. I noticed some read/write locking in tagcache.c but it covers only part of the file read/write operations.

If "Gather Runtime Data" is not enabled (no disk file write) or "Load to RAM" is enabled (no disk file read) everything work smoothly in the above scenarios because there are no overlapping file operations.
This task depends upon

Closed by  Bertrik Sikken (bertrik)
Monday, 19 July 2010, 09:57 GMT
Reason for closing:  Works For Me
Additional comments about closing:  Can't reproduce on my e200 either, possibly fixed by tagcache cleanups since february 2010.
Comment by Ben Zavala (bzavala) - Monday, 10 March 2008, 16:34 GMT
I remember seeing this behavior that the tracks disappear after being selected from the database so I just decided to reproduce it following your steps. The results: I was not able to reproduce any of the 2 scenarios with today's build r16601-080310. This was tried on an iPod Video 5.5 gen

Comment by Marcel Barbulescu (marcelbarbulescu) - Monday, 10 March 2008, 16:43 GMT
I just read the bug description again and I saw that I made a mistake in the first phrase: you need to have "Gather Runtime Data" ENABLED and "Load to RAM" disabled in order to reproduce the bug. Was this your config?

Thanks for testing.
Comment by Ben Zavala (bzavala) - Monday, 10 March 2008, 22:28 GMT

I did try with Gather Runtime Data ENABLED and Load to RAM DISABLED. On both cases, the screen shows the names of the tracks.

Are you on the most recent build?

Comment by Marcel Barbulescu (marcelbarbulescu) - Monday, 10 March 2008, 22:36 GMT
Yes, the most recent build. I can even reproduced it on the iPod Simulator (while in Album view press Space twice fast and you'll get an empty or shorter Album list).
(I suspect that any Simulator build will behave the same regarding to this issue.)

Maybe disk reads/writes behave differently on iPods (different disk driver?).
BigBambi from IRC also confirmed the problem with both Sansa e200 and Gigabeat.

Thank you Ben.
Comment by amaury pouly (pamaury) - Saturday, 06 February 2010, 18:20 GMT
Does this bug still exists ? I can't reproduce it on my Sansa e200.