Bug 13699

Summary: DBD::mysql mysql_auto_reconnect attribute ceases to function after DBIx call[s]
Product: Koha Reporter: Jacek Ablewicz <abl>
Component: Architecture, internals, and plumbingAssignee: Galen Charlton <gmcharlt>
Status: RESOLVED DUPLICATE QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: fridolin.somers, tomascohen, veron
Version: Main   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14375
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14600
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 13669: followup to add DBIx::RunSQL dependency

Description Jacek Ablewicz 2015-02-12 08:52:18 UTC
While testing Bug 13645 patch #2, I noticed that DBIx calls apparently do interfere with DBD::mysql mysql_auto_reconnect attribute.

We have mysql auto reconnect enabled since Bug 10611, and it works fine as long as there are no DBIx calls being made - but if there is such a call in the given code, this attribute gets reseted to 0 as a side affect, disabling auto reconnect feature for all further DBI or DBIx calls being made from the same process and/or thread. E.g.:

use Modern::Perl;
use C4::Context;
use Koha::Acquisition::Bookseller;

my $dbh = C4::Context->dbh;
print "Auto reconnect: ".$dbh->{mysql_auto_reconnect}."\n";
my @booksellers = Koha::Acquisition::Bookseller->search();
print "Auto reconnect: ".$dbh->{mysql_auto_reconnect}."\n";
## $dbh->{mysql_auto_reconnect}=1;
sleep(15); ## mysqld to be reloaded in the meanwhile
@booksellers = Koha::Acquisition::Bookseller->search();

Auto reconnect: 1
Auto reconnect: 0
DBD::mysql::st execute failed: MySQL server has gone away at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1593.

At first I assumed that it may be caused by 'Bug 13645: Use DBIx::Connector', but nope, it turns out that this issue is also present in unpatched master.
Probably not such a big problem for the plain CGI setups in most typical circumstances, but lack of working auto reconnect may be quite a nuisance under plack/mod_perl.
Comment 1 Fridolin Somers 2015-06-18 12:08:02 UTC
Surely linked to Bug 14374 and Bug 14375
Comment 2 Tomás Cohen Arazi 2015-10-20 23:18:09 UTC

*** This bug has been marked as a duplicate of bug 14778 ***
Comment 3 Marc Véron 2016-05-24 14:12:59 UTC Comment hidden (obsolete)
Comment 4 Marc Véron 2016-05-24 14:17:41 UTC
Comment on attachment 51737 [details] [review]
Bug 13669: followup to add DBIx::RunSQL dependency

I mistaked with the bug number, sorry for the noise.