Bugzilla – Bug 4160
scanner.pl fails to connect to existing MySQL instance
Last modified: 2011-03-16 04:39:12 UTC
This is using r9916 of SlimServer 6.5 I have an existing MySQL instance (version 4.1.21) on Gentoo Linux. I've set up the appropriate entries in slimserver.pref to use this instance rather than SlimServer's own. This has been working for a long time. SlimServer starts fine, and I can browse around artists/albums etc and play music, so the main SlimServer process is accessing that existing instance with no problems. I've just noticed that when trying to do a "clear-and-rescan" my scanner.pl quickly fails with the following in the log: ---- 2006-09-20 19:09:51.2865 SlimServer OSDetect init... 2006-09-20 19:09:51.2874 SlimServer OS Specific init... 2006-09-20 19:09:51.2877 SlimServer settings init... 2006-09-20 19:09:51.3787 SlimServer strings init... 2006-09-20 19:09:52.3632 SlimServer Info init... 2006-09-20 19:09:52.7658 ERROR: DBI Connection failed: DBI connect('database=slimserver','slimserver',...) failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) at /usr/local/slimserver/server/CPAN/DBIx /Class/Storage/DBI.pm line 652 2006-09-20 19:09:52.7663 ERROR: Backtrace follows: 2006-09-20 19:09:52.7672 Backtrace: frame 0: Slim::Schema::Storage::throw_exception (/usr/local/slimserver/server/CPAN/DBIx/Class/Storage/DBI.pm line 658) frame 1: DBIx::Class::Storage::DBI::_connect (/usr/local/slimserver/server/CPAN/DBIx/Class/Storage/DBI.pm line 616) frame 2: DBIx::Class::Storage::DBI::_populate_dbh (/usr/local/slimserver/server/CPAN/DBIx/Class/Storage/DBI.pm line 543) frame 3: DBIx::Class::Storage::DBI::ensure_connected (/usr/local/slimserver/server/CPAN/DBIx/Class/Storage/DBI.pm line 557) frame 4: DBIx::Class::Storage::DBI::dbh (/usr/local/slimserver/server/Slim/Schema.pm line 120) frame 5: Slim::Schema::init (/usr/local/slimserver/server/Slim/Music/Info.pm line 71) frame 6: Slim::Music::Info::init (/usr/local/slimserver/server/scanner.pl line 239) frame 7: main::initializeFrameworks (/usr/local/slimserver/server/scanner.pl line 86) frame 8: main::main (/usr/local/slimserver/server/scanner.pl line 330) Carp::Clan::__ANON__(): DBI Connection failed: DBI connect('database=slimserver','slimserver',...) failed: Can't connect to local MySQL server through socket '/ var/lib/mysql/mysql.sock' (13) at /usr/local/slimserver/server/CPAN/DBIx/Class/Storage/DBI.pm line 652 2006-09-20 19:09:52.7685 Got to the END. ---- The socket file shown ("/var/lib/mysql/mysql.sock") isn't the right one for my server, and isn't the one shown with "mysql_config --socket"). I've looked through how the thing starts up and as far as I can see it's because MySQLHelper::init hasn't been called to set the Slim::Utils::MySQLHelper->socketFile. Looking at the start of scanner.pl I can see that the line "Slim::Utils::MySQLHelper->init()" has been commented out (quite a long time ago - r7707 I think). Uncommenting that line gets things working for me again. I've not given it a thorough test, and as I use my own instance I've no idea on the impact on SlimServer's own instance of such a change (or on other platforms), but there's definitely a problem at the moment with using my own instance unless I do this. This is odd, since I'm certain it has been working in the last week or so (I've done lots of clears-and-rescans in my plugin development so I'm confident of that), so there must have been another change since 7707 that has had this knock-on effect. Of course, running your own instance maybe isn't in the core functionality you're aiming for for 6.5.0's release, so this may get put off until later.
there is a binary in CPAN/arch/5.8/i386-linux-thread-multi/auto/DBD/mysql/ delete that and see if that's the conflict. you may also need to upgrade your mysql. I'm not sure of the exact minimum, but 5.0+ is certainly the recommendation is this still an issue with 6.5.0? we can remark the version if so.
MySQL 5.0 as a minimum? In that case maybe you should tidy that comment about you in Slim/Schema.pm, kdf! I'll see about an MySQL update (for some reason the 5.x series isn't yet marked stable on Gentoo - I'll have to look into that). Removing those binaries certainly avoids the problem - the scanner now completes fine. Of course, those files will pop back the next time I do an update, but at least I'll know how to solve it. I remember a mention of something about those binaries on the forums some time ago, but my forum searching ability seems to have escaped me this morning. This is definitely still a problem for me in 6.5.0 - I'm at svn r9933 in branches/6.5. I've therefore updated the version (I don't remember seeing that option when I raised the bug, but it was quite late). I'll see about a MySQL update and report back... Thanks very much for the help and well done on all the work in 6.5.
I've moved my server up to MySQL version 5.0.24a and I can confirm I still have the problem. Without having investigated it too much it looks like a clash between SlimServer's local CPAN modules and the ones I've installed in the main perl installation. I have the following in my main perl installation: DBI-1.50 DBD-mysql-2.9007 And build-perl-modules.pl wants to bring in: DBI-1.50 (same) DBD-mysql-3.0002 (newer than mine). I do remember some forum discussions about CPAN precedence as far as modules were concerned, but I can't find it now or remember the details.
thank you. I'm really pleased that I can be slapped about the comment put in to complain about me. btw...I'm using 5.0.22 now. I ran into the same problem with the mysql.so, and Dan managed to fix it. Not sure why it is still a problem in other cases. dan?
Change dbsource in your slimserver.pref to have: ;mysql_socket=/path/to/your/mysql.sock
Well, that works for me, so is a good and persistent workaround. I think I'll update the wiki page on using your own MySQL - it needs a freshening up now that 6.5.0 has hit the streets since it talks about MySQL in general being experimental and unsupported. When I'm doing that I'll drop in this advice as well. Thanks for the answer, Dan.
Great. Thanks for taking time to update the Wiki