Bug #64475 select* methods output misleading error messages on InnoDB lock timeout
Submitted: 27 Feb 2012 20:15 Modified: 15 Feb 2013 16:46
Reporter: Frederic Briere Email Updates:
Status: Unsupported Impact on me:
None 
Category:Connectors: DBD::mysql ( Perl ) Severity:S3 (Non-critical)
Version:4.020 OS:Any
Assigned to: CPU Architecture:Any

[27 Feb 2012 20:15] Frederic Briere
Description:
The various select* methods (such as selectrow_hashref or selectcol_arrayref) output misleading error messages when a timeout occurs while waiting for an InnoDB lock.  (For example, selectrow_hashref outputs "fetch() without execute()", and selectcol_arrayref outputs "Statement has no result columns to bind".)

From the look of it, the methods appear to not notice that execute() has failed, and proceed to call fetch() nonetheless.  The resulting error message thus reflects the failure from wrongly calling fetch(), instead of the original timeout error (which is found to be accurately reported by the MySQL server with DBI_TRACE).

How to repeat:
Create an InnoDB table:

mysql> use test
mysql> create table t(i int primary key) engine = innodb;

Acquire a row lock on this table:

mysql> begin;
mysql> insert into t values (1);

From a console, run a query via select* that tries to acquire the same lock:

$ perl -MDBI -e '$dbh = DBI->connect("DBI:mysql:database=test", "...", "...", {RaiseError=>1}); $dbh->begin_work; $dbh->selectrow_hashref("SELECT i FROM t FOR UPDATE")'
[28 Feb 2012 18:58] Sveta Smirnova
Thank you for the report.

Verified as described.
[15 Feb 2013 16:46] Sveta Smirnova
Thank you for the report.

We don't work on DBD::mysql bugs anymore. All its bugs should go to CPAN: https://rt.cpan.org/Public/Dist/Display.html?Name=DBD-mysql

I re-submitted your report to https://rt.cpan.org/Public/Bug/Display.html?id=83351
Please subscribe to the new report on CPAN and work with DBD::mysql developers in case if they need additional details.