• Status Closed
  • Percent Complete
  • Task Type Bugs
  • Category Database
  • Assigned To
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version Daily build (which?)
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by wpyh - 2008-06-16
Last edited by speachy - 2021-05-19

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

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.

Closed by  speachy
2021-05-19 20:33
Reason for closing:  Accepted
Additional comments about closing:   Warning: Undefined array key "typography" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 371 Warning: Undefined array key "camelcase" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 407

Finally committed as 3ed035769c

How do you tell it’s hanging?

wpyh commented on 2008-06-17 10:32

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 ;)

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.

wpyh commented on 2008-12-25 17:15

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.

wpyh commented on 2008-12-26 04:55

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.

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.

Here’s a patch based on wpyh’s that I have a bit more confidence in.

Shouldn’t this patch be committed?


Available keyboard shortcuts


Task Details

Task Editing