Skip Menu |
 

This queue is for tickets about the DBIx-Class CPAN distribution.

Report information
The Basics
Id: 110429
Status: patched
Priority: 0/
Queue: DBIx-Class

People
Owner: Nobody in particular
Requestors: SHOGO [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.082820
Fixed in: (no value)



Subject: Reconnection does not work if timeout occurs in a transaction
Download (untitled) / with headers
text/plain 1.7k
Reconnection does not work if timeout occurs in a transaction. my-script.pl use feature 'say'; use My::Schema; my $schema = My::Schema->connect('dbi:mysql:host=127.0.0.1;port=3306;database=test;mysql_write_timeout=1;mysql_read_timeout=1', 'root', ''); my $user_rs = $schema->resultset('User'); say 'transaction_depth = ', $schema->storage->{transaction_depth}; # => transaction_depth = 0 eval { my $txn = $schema->txn_scope_guard; say 'transaction_depth = ', $schema->storage->{transaction_depth}; # => transaction_depth = 1 # timeout $user_rs->search({}, {select => \'SLEEP(10)'})->all; } # I expect that transaction_depth is 0, but transaction_depth is 1 actually. say 'transaction_depth = ', $schema->storage->{transaction_depth}; # => transaction_depth = 1 # I expect that DBIx::Class reconnects to MySQL, # but this code dies with "MySQL server has gone away" actually. $user_rs->search({ id => 1 })->single; User.pm package My::Schema::User; use base 'DBIx::Class::Core'; __PACKAGE__->table('user'); __PACKAGE__->add_columns( id => { data_type => 'INTEGER', is_nullable => 0, is_auto_increment => 1, }, username => { data_type => 'VARCHAR', size => 255, is_nullable => 0, }, ); __PACKAGE__->set_primary_key('id'); 1; Schema.pm package My::Schema; use base 'DBIx::Class::Schema'; __PACKAGE__-> load_namespaces; 1; My environment is: - DBIx::Class version 0.082820. - This is perl 5, version 20, subversion 2 (v5.20.2) built for x86_64-linux - CentOS release 6.6 (Final)
Download (untitled) / with headers
text/plain 190b
Thank you for the report. This turned out to be much more involved than I originally anticipated, but should be fixed now by https://github.com/dbsrgits/dbix-class/commit/729656c50. Cheers!


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.