Bug 8261 - AutoCommit=0 causes DBIx's own transactions to fail
: AutoCommit=0 causes DBIx's own transactions to fail
Status: NEW
Product: Logitech Media Server
Classification: Unclassified
Component: Database
: 7.4.0
: All All
: P2 normal (vote)
: New Schema
Assigned To: Brandon Black
: new_schema
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-05-28 15:44 UTC by Darren Edmundson
Modified: 2009-07-30 14:02 UTC (History)
1 user (show)

See Also:
Category: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Darren Edmundson 2008-05-28 15:44:24 UTC
Setting Autocommit=0 on the DB handle in Slim/Music/Import.pm and Slim/Schema/Playlist.pm causes recent DBI + DBD::Mysql + DBIx to crash; autocommit=0 is implemented by starting an implicit transaction, so when DBIx::Class::Schema::txn_do tries to start a second one, DBD::Mysql falls over with an error like:

[08-05-28 23:04:02.7414] Slim::Music::Import::setIsScanning (266) Error: Failed to update isScanning: [Carp::Clan::__ANON__(): Carp::Clan::__ANON__(): DBI Exception: DBD::mysql::db begin_work failed: Already in a transaction at /usr/lo
cal/squeezecenter/Slim/Schema/Storage.pm line 74

...and no writes to the database ever happen. From a fresh install, that means that you can never add any music to the library, leaving squeezecenter somewhat useless.

The supposed performance gains you get from turning autocommit off don't exist anyway. As DBIx is using transactions and committing (or rolling back) each one, the writes and synchronisation are happening no matter what autocommit is set to - thats if it didn't crash...

The fix - remove the
  Slim::Schema->storage->dbh->{'AutoCommit'} = 0;
from Import.pm and Playlist.pm
Comment 1 Stuart Henderson 2008-10-10 09:21:31 UTC
Confirmed here; scanner.pl needs the same change (but then there are bogus warnings about unnecessary commits).