Rockbox

Tasklist

FS#9093 - Database initialization hangs if there's no music file on the player

Attached to Project: Rockbox
Opened by William Poetra Yoga Hadisoeseno (wpyh) - Monday, 16 June 2008, 08:58 GMT
Last edited by sideral (sideral) - Tuesday, 03 May 2011, 15:17 GMT
Task Type Bugs
Category Database
Status Assigned
Assigned To sideral (sideral)
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

The database hangs when doing initialization if there is no music file on the player.

How to reproduce:
1. Install Rockbox.
2. Put some music files onto the device.
3. Initialize database.
4. Reboot.
5. Remove all music files from the player.
6. Initialize database.
This task depends upon

Comment by Dominik Riebeling (bluebrother) - Monday, 16 June 2008, 20:19 GMT
How do you tell it's hanging?
Comment by William Poetra Yoga Hadisoeseno (wpyh) - Tuesday, 17 June 2008, 10:32 GMT
Here's how:

1-6. Repeat the steps I described above.
7. Go to Main Menu, scroll to Database, try to open it (for example by pressing the SELECT button on the iPod).
8. It says "xxx files found". Press |<< to return to the Main Menu.
9. Go eat your lunch.
10. Go to Main Menu, scroll to Database, open it.
11. It says "xxx files found". The number didn't change. Press |<< to return to the Main Menu.
12. Go eat your dinner.
... and so on.

Of course, if the device runs out of battery, then it will power off ;)
Comment by Bart (debber) - Tuesday, 16 December 2008, 14:19 GMT
Step 2, 3, 4 and 5 of the original bugreport are not needed. Simply try to initialize the database when no music files are present does it as well.

When you put an empty file (0 bytes) mp3 file, the behaviour is the same.
As soon as at least 1 valid mp3 (or other music file) is present then the initialization of the database finishes.
Comment by William Poetra Yoga Hadisoeseno (wpyh) - Thursday, 25 December 2008, 17:15 GMT
This patch seems to fix the problem.
1. If there is no music file found, the database is initialized anyway.
2. Upon reboot, the database is fully functional, except that it is empty.

Is this solution/workaround acceptable? I personally find it logical to create an empty database.
Comment by William Poetra Yoga Hadisoeseno (wpyh) - Friday, 26 December 2008, 04:55 GMT
Sometimes, doing an "Update Database" will make the database unusable. This patch also fixes that problem, and is less invasive (entry_count==0 is still being logged).

I hope that this is a better solution.
Comment by sideral (sideral) - Tuesday, 03 May 2011, 15:17 GMT
  • Field changed: Task Type (Patches → Bugs)
  • Field changed: Status (Unconfirmed → New)
Thanks for the patch, wpyh!

I agree that the DB-init hang when no music files are present is a bug, and that an empty DB should be prepared instead.

I don't quite understand the failure modes against which the check above the “we can't append!” warning is supposed to protect – neither in the present version nor in your modified version of the check. How can the condition ever be true in your version?

Note that lseek returns a negative value in case of an error. There probably should be a check for this condition as well.
Comment by sideral (sideral) - Sunday, 22 May 2011, 21:47 GMT
Here's a patch based on wpyh's that I have a bit more confidence in.
Comment by Thomas Martitz (kugel.) - Thursday, 16 January 2014, 16:01 GMT
Shouldn't this patch be committed?

Loading...