Bugzilla – Bug 2850
server crashes due to MySQL foreign key constraints
Last modified: 2008-09-15 14:39:24 UTC
r5727 w/MySQL. I changed a misspelled artist name in the database and did a rescan (without clearing). SlimServer crashes due to a foreign key constraint error when it tries removing the no longer used data. 2006-01-21 13:46:31.6930 finished background scan of music folder. 2006-01-21 13:46:31.8567 forceCommit: syncing to the database. 2006-01-21 13:46:51.0911 forceCommit: syncing to the database. 2006-01-21 13:47:02.1312 cleared file:////bob/music/flac/Art%20Blakey/Art%20Blakey%27s%20Jazz%20Messengers%20With%20Thelonius%20Monk from database 2006-01-21 13:47:02.4362 DBD::mysql::st execute failed: Cannot delete or update a parent row: a foreign key constraint fails at C:\Program Files\SlimServer\server\lib/Class/DBI.pm line 835. Can't delete file:////bob/music/flac/Art%20Blakey/Art%20Blakey%27s%20Jazz%20Messengers%20With%20Thelonius%20Monk/01%20Evidence.flac: DBD::mysql::st execute failed: Cannot delete or update a parent row: a foreign key constraint fails at C:\Program Files\SlimServer\server\lib/Class/DBI.pm line 835. at C:/Program Files/SlimServer/server/Slim/DataStores/DBI/DBIStore.pm line 720 2006-01-21 13:47:02.4375 forceCommit: syncing to the database.
Correction/clarification: I changed an artist _tag_ in an album's worth of Flac files. Also, the name of the folder was changed (since the misspelled artist name was a part of the album name). Looks like the change in folder name may have been the source of the error. Jazz Messengers With Thelonius Monk -> Jazz Messengers With Thelonious Monk
Just happened again, except that this time it wasn't during a scan. After renaming a folder and retagging files with a corrected artist name, the server just crashed while browsing artwork. I wasn't aware that SlimServer attempted to modify the database except during BMF and a scan. 2006-01-29 17:32:18.6323 _hasChanged: Checking for [\\bob\music\flac\Joanna Newsome\The Milk-Eyed Mender\01 Bridges And Balloons.flac] - size & timestamp. 2006-01-29 17:32:18.7037 _hasChanged: removing [\\bob\music\flac\Joanna Newsome\The Milk-Eyed Mender\01 Bridges And Balloons.flac] from the db as it no longer exists. 2006-01-29 17:32:18.9614 DBD::mysql::st execute failed: Cannot delete or update a parent row: a foreign key constraint fails at C:\Program Files\SlimServer\server\lib/Class/DBI.pm line 835. Can't delete file:////bob/music/flac/Joanna%20Newsome/The%20Milk-Eyed%20Mender/01%20Bridges%20And%20Balloons.flac: DBD::mysql::st execute failed: Cannot delete or update a parent row: a foreign key constraint fails at C:\Program Files\SlimServer\server\lib/Class/DBI.pm line 835. at C:/Program Files/SlimServer/server/Slim/DataStores/DBI/DBIStore.pm line 714 2006-01-29 17:32:19.0595 forceCommit: syncing to the database.
*** Bug 2898 has been marked as a duplicate of this bug. ***
similar foreign key crashes are being reported over 6.2.1 and several nightly builds. making summary more generic to reflect this
*** Bug 2917 has been marked as a duplicate of this bug. ***
Still seeing the bug: 2006-02-07 15:17:55.844416500 DBD::mysql::st execute failed: Cannot delete or update a parent row: a foreign key constraint fails at /home/slimserver/trunk/server/lib/Class/DBI.pm line 835. 2006-02-07 15:17:55.844424500 Can't delete file:///home/slimserver/music/library/Temp(cla)/Giuseppe%20Verdi/Messa%20da%20Requiem%20&%20Quattro%20Pezzi%20Sacri%20(Disc%201%20of%202)/04%20-%20Requiem%202.3%20Dies%20Irae%20Liber%20Scriptus.flac: DBD::mysql::st execute failed: Cannot delete or update a parent row: a foreign key constraint fails at /home/slimserver/trunk/server/lib/Class/DBI.pm line 835. 2006-02-07 15:17:55.844477500 at /home/slimserver/trunk/server/Slim/DataStores/DBI/DBIStore.pm line 714 This happens when I execute a search from the web interface. Additional information: The file in question no longer exists in that location - I've moved it elsewhere in the library.
I think this is also related. 6.2.2 Nightly (3 Feb)/CC3.2/MySQL Slimserver crashes with: 2006-02-10 12:11:11.5988 DBD::mysql::st execute failed: Cannot delete or update a parent row: a foreign key constraint fails at /usr/local/slimserver/CPAN/DBIx/ ContextualFetch.pm line 51. Can't delete file:///home/shared/Music/Disk2/Music2/Foo%20Fighters/One%20By%20On e/01-Foo%20Fighters-All%20my%20life.flac: DBD::mysql::st execute failed: Cannot delete or update a parent row: a foreign key constraint fails at /usr/local/slim server/CPAN/DBIx/ContextualFetch.pm line 51. at /usr/local/slimserver/Slim/DataStores/DBI/DBIStore.pm line 652 when it can't find a (renamed) music file in Random Play.
I do have the same thing when using mysql, but I have 5.? installed. Have heard that 5.x has problems so have just assumed this is the case. Since mysql is still not officially supported for slimserver, this really can't qualify as major, since this function technically does not exist in order to be lost.
FWIW I'm on MySQL 4.1.12
Also using 4.1.x. This isn't a MySQL bug, it's an application bug. Major, minor, trivial, enhancement request, whatever - it's a crasher.
managed to complete a scan, no foreign key problems svn 6779 from trunk (nearly the apri1 6.5 build), mysql Ver 12.22 Distrib 4.0.22, for pc-linux (i386).
Did you make any changes to folder names? Try renaming a folder and running a scan without clear.
I've checked in a fix for this as change 6815. I didn't bump the DB version number however - so you'll need to drop all your tables manually. Please verify that this has been fixed. Thanks.
Seems to fix the problems I was seeing. Scanned the library with the new schema, then renamed a folder and did a second scan without clear. The scan completed successfully and picked up the changed paths. Then I renamed a different folder and began browsing in the web UI. SlimServer removed the missing files from the database without crashing. Also, moved some files out of a folder and browsed with the same results. Not sure if this covers all the cases, but looks pretty solid so far.