Skip Menu |

This queue is for tickets about the DBD-mysql CPAN distribution.

Report information
The Basics
Id: 14979
Status: resolved
Worked: 20 min
Priority: 0/
Queue: DBD-mysql

People
Owner: CAPTTOFU [...] cpan.org
Requestors: DDICK [...] cpan.org
Cc:
AdminCc:

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



Subject: Server side prepared statements clash with forked handles
This occurs even when InactiveDestroy has been used to mark the appropriate process. See attached file to replicate.
#! /usr/local/bin/perl -wT use strict; use DBI(); MAIN: { $ENV{'DBI_DSN'} ||= 'dbi:mysql:dbname=mysql:mysql_server_prepare=1'; $ENV{'DBI_USER'} ||= 'root'; $ENV{'DBI_PASS'} ||= ''; my ($dbh) = DBI->connect($ENV{DBI_DSN}, $ENV{DBI_USER}, $ENV{DBI_PASS}, {RaiseError => 1, PrintError => 0, AutoCommit => 0}); # $dbh->{pg_server_prepare} = 0; my ($sql) = qq[SELECT * FROM mysql.user WHERE user LIKE ?]; my ($sth) = $dbh->prepare($sql); $sth->execute('foo'); $sth->finish(); my ($pid); if ($pid = fork()) { waitpid($pid, 0); unless ($? == 0) { die("Child failed to execute successfully\n"); } } elsif (defined $pid) { $dbh->{'InactiveDestroy'} = 1; exit(0); } else { die("Failed to fork:$!\n"); } $sth->execute('foo'); $sth->finish(); $dbh->disconnect(); }
Thanks for the bug report! This still fails as of 4.00. Will look into this. added bug14979.pl to eg/ dir
On Sat Jan 06 12:49:29 2007, CAPTTOFU wrote: Show quoted text
> added bug14979.pl to eg/ dir
Hey Patrick, If I run the sample script it just executes. I'm not *sure* how to read the trace but I think it works now, right? DBI::db=HASH(0xa00e6a0) trace level set to 0x0/3 (DBI @ 0x0/0) in DBI 1.629-nothread (pid 6802) -> prepare for DBD::mysql::db (DBI::db=HASH(0xa00e650)~0xa00e6a0 'SELECT * FROM mysql.user WHERE user LIKE ?') 1 <- _async_check= ( 1 ) [1 items] at mysql.pm line 227 via at bug14979.pl line 13 -> dbd_st_prepare MYSQL_VERSION_ID 50531, SQL statement: SELECT * FROM mysql.user WHERE user LIKE ? Show quoted text
>- dbd_st_free_result_sets
<- dbd_st_free_result_sets RC -1 <- dbd_st_free_result_sets Show quoted text
>count_params statement SELECT * FROM mysql.user WHERE user LIKE ?
<- dbd_st_prepare <- prepare= ( DBI::st=HASH(0xa00e340) ) [1 items] at bug14979.pl line 13 -> execute for DBD::mysql::st (DBI::st=HASH(0xa00e340)~0xa00e370 'foo') Called: dbd_bind_ph -> dbd_st_execute for 09f9d6b0 Show quoted text
>- dbd_st_free_result_sets
<- dbd_st_free_result_sets RC -1 <- dbd_st_free_result_sets mysql_st_internal_execute MYSQL_VERSION_ID 50531 Show quoted text
>parse_params statement SELECT * FROM mysql.user WHERE user LIKE ?
Binding parameters: SELECT * FROM mysql.user WHERE user LIKE 'foo' <- dbd_st_execute returning imp_sth->row_num 0 <- execute= ( '0E0' ) [1 items] at bug14979.pl line 14 -> finish for DBD::mysql::st (DBI::st=HASH(0xa00e340)~0xa00e370) --> dbd_st_finish Show quoted text
>- dbd_st_free_result_sets
<- dbd_st_free_result_sets RC -1 <- dbd_st_free_result_sets <-- dbd_st_finish <- finish= ( 1 ) [1 items] at bug14979.pl line 15 -> STORE for DBD::mysql::db (DBI::db=HASH(0xa00e6a0)~INNER 'InactiveDestroy' 1) STORE DBI::db=HASH(0xa00e6a0) 'InactiveDestroy' => 1 <- STORE= ( 1 ) [1 items] at bug14979.pl line 23 -> DESTROY for DBD::mysql::st (DBI::st=HASH(0xa00e370)~INNER) Freeing 1 parameters, bind 0 fbind 0 <- DESTROY= ( undef ) [1 items] at bug14979.pl line 24 via at bug14979.pl line 24 -> DESTROY for DBD::mysql::db (DBI::db=HASH(0xa00e6a0)~INNER) DESTROY DBI::db=HASH(0xa00e6a0) skipped due to InactiveDestroy <- DESTROY= ( undef ) [1 items] at bug14979.pl line 24 via at bug14979.pl line 24 -> execute for DBD::mysql::st (DBI::st=HASH(0xa00e340)~0xa00e370 'foo') Called: dbd_bind_ph -> dbd_st_execute for 09f9d6b0 Show quoted text
>- dbd_st_free_result_sets
<- dbd_st_free_result_sets RC -1 <- dbd_st_free_result_sets mysql_st_internal_execute MYSQL_VERSION_ID 50531 Show quoted text
>parse_params statement SELECT * FROM mysql.user WHERE user LIKE ?
Binding parameters: SELECT * FROM mysql.user WHERE user LIKE 'foo' <- dbd_st_execute returning imp_sth->row_num 0 <- execute= ( '0E0' ) [1 items] at bug14979.pl line 28 -> finish for DBD::mysql::st (DBI::st=HASH(0xa00e340)~0xa00e370) --> dbd_st_finish Show quoted text
>- dbd_st_free_result_sets
<- dbd_st_free_result_sets RC -1 <- dbd_st_free_result_sets <-- dbd_st_finish <- finish= ( 1 ) [1 items] at bug14979.pl line 29 -> disconnect for DBD::mysql::db (DBI::db=HASH(0xa00e650)~0xa00e6a0) imp_dbh->pmysql: a03c430 <- disconnect= ( 1 ) [1 items] at bug14979.pl line 30 -> DESTROY for DBD::mysql::st (DBI::st=HASH(0xa00e370)~INNER) Freeing 1 parameters, bind 0 fbind 0 <- DESTROY= ( undef ) [1 items] at bug14979.pl line 7 via at bug14979.pl line 7 -> DESTROY for DBD::mysql::db (DBI::db=HASH(0xa00e6a0)~INNER) <- DESTROY= ( undef ) [1 items] at bug14979.pl line 7 via at bug14979.pl line 7