Bug 2850 - server crashes due to MySQL foreign key constraints
: server crashes due to MySQL foreign key constraints
Status: RESOLVED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Database
: 6.5b1
: PC Windows XP
: P2 major with 1 vote (vote)
: ---
Assigned To: Dan Sully
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-01-21 13:04 UTC by Jim McAtee
Modified: 2008-09-15 14:39 UTC (History)
7 users (show)

See Also:
Category: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jim McAtee 2006-01-21 13:04:23 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.
Comment 1 Jim McAtee 2006-01-21 13:12:57 UTC
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
Comment 2 Jim McAtee 2006-01-29 19:38:09 UTC
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.
Comment 3 KDF 2006-01-30 15:15:07 UTC
*** Bug 2898 has been marked as a duplicate of this bug. ***
Comment 4 KDF 2006-01-30 15:19:26 UTC
similar foreign key crashes are being reported over 6.2.1 and several nightly builds.  making summary more generic to reflect this
Comment 5 Ben Gladstone 2006-02-02 09:41:17 UTC
*** Bug 2917 has been marked as a duplicate of this bug. ***
Comment 6 Robin Bowes 2006-02-07 13:06:26 UTC
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.
Comment 7 Patrick Dixon 2006-02-10 06:42:39 UTC
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.
Comment 8 KDF 2006-02-10 08:52:17 UTC
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.
Comment 9 Patrick Dixon 2006-02-10 09:04:49 UTC
FWIW I'm on MySQL 4.1.12
Comment 10 Jim McAtee 2006-02-10 09:15:33 UTC
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.
Comment 11 KDF 2006-04-01 12:23:19 UTC
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). 
Comment 12 Jim McAtee 2006-04-01 15:27:55 UTC
Did you make any changes to folder names?  Try renaming a folder and running a scan without clear.

Comment 13 Dan Sully 2006-04-03 14:15:17 UTC
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.
Comment 14 Jim McAtee 2006-04-03 16:28:21 UTC
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.