Skip Menu |

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

Report information
The Basics
Id: 21946
Status: resolved
Priority: 0/
Queue: DBD-mysql

People
Owner: Nobody in particular
Requestors: gdelfino [...] mac.com
Cc:
AdminCc:

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



Subject: Server side prepared statements don't work under Mac OS X (Bus error)
Hello all, DBD::mysql prepared statements are not working under Mac OS X 10.4.8. Trying to use mysql_server_prepare=1 results in a bus error. I have reproduced this on a PowerBook G4 and on a dual processor PowerMac G5. Oddly, all the tests are passing OK. All test are passing with mysql_server_prepare=1: $ cd ~/src/DBD-mysql-3.0007 $ export MYSQL_SERVER_PREPARE=1 $ export SLOW_TESTS=1 $ make test PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/ lib', 'blib/arch')" t/*.t t/00base.............ok t/10dsnlist..........ok t/20createdrop.......ok t/30insertfetch......ok t/35limit............ok t/35prepare..........ok t/40bindparam........ok t/40bindparam2.......ok t/40blobs............ok t/40listfields.......ok t/40nulls............ok t/40numrows..........ok t/41bindparam........ok t/41blobs_prepare....ok t/42bindparam........ok t/50chopblanks.......ok t/50commit...........ok t/60leaks............ok t/dbdadmin...........ok t/insertid...........ok t/param_values.......ok t/prepare_noerror....skipped all skipped: test - will only run with MySQL 5.1 and above. t/texecute...........ok All tests successful, 1 test skipped. Files=23, Tests=443, 58 wallclock secs (14.84 cusr + 9.45 csys = 24.29 CPU) All test are also passing without mysql_server_prepare=1: $ unset MYSQL_SERVER_PREPARE $ make test PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/ lib', 'blib/arch')" t/*.t t/00base.............ok t/10dsnlist..........ok t/20createdrop.......ok t/30insertfetch......ok t/35limit............ok t/35prepare..........ok t/40bindparam........ok t/40bindparam2.......ok t/40blobs............ok t/40listfields.......ok t/40nulls............ok t/40numrows..........ok t/41bindparam........ok t/41blobs_prepare....ok t/42bindparam........ok t/50chopblanks.......ok t/50commit...........ok t/60leaks............ok t/dbdadmin...........ok t/insertid...........ok t/param_values.......ok t/prepare_noerror....skipped all skipped: test - will only run with MySQL 5.1 and above. t/texecute...........ok All tests successful, 1 test skipped. Files=23, Tests=449, 46 wallclock secs (12.13 cusr + 7.90 csys = 20.03 CPU) Now the details of my program. It is a small script with a single prepare outside a loop: #!/usr/bin/perl use GD; use DBI; # Load Database Interface Module use Data::Dumper; # Connect to database my $dbh = DBI->connect ('DBI:mysql:database=database_name;host=localhost:mysql_server_prepare=1', 'myUser', 'myPassword', {RaiseError => 1}) or die "$0: Can not connect to database: " . $DBI::errstr; # create a new image $im = new GD::Image(6490,4000); # allocate color black $black = $im->colorAllocate(0,0,0); # The maximum id value in table is 25958999 my $sth = $dbh->prepare("SELECT id FROM myTable WHERE id=?"); my $id = 1; foreach $x (0..6489) { print "x=$x/6490 id=$id\n"; foreach $y (0..3999){ $sth->execute($id); if ($sth->fetchrow_array) { $im->setPixel($x,$y,$black); } $id = $id + 1; } open(OUT,">/Users/gdelfino/id.png") or die "can not write output file"; binmode OUT; print OUT $im->png; close(OUT); # I wish there were a "tail -f" equivalent for images } When I run it I get the following error: $ perl -w id_photo.pl x=0/6490 id=1 Bus error If I replace mysql_server_prepare=1 with mysql_server_prepare=0, the program runs just fine . My DBD::mysql version is: $ perldoc -m DBD::mysql | grep '$VERSION =' $VERSION = '3.0007'; My DBI version is: $ perldoc -m DBI | grep '^$DBI::VERSION' $DBI::VERSION = "1.52"; The version of mysql that I am using is: $ mysql --version mysql Ver 14.7 Distrib 4.1.21, for apple-darwin8.6.0 (powerpc) using readline 4.3 My perl version is: $ perl -V Summary of my perl5 (revision 5 version 8 subversion 6) configuration: Platform: osname=darwin, osvers=8.0, archname=darwin-thread-multi-2level uname='darwin b28.apple.com 8.0 darwin kernel version 7.5.0: thu mar 3 18:48:46 pst 2005; root:xnuxnu-517.99.13.obj~1release_ppc power macintosh powerpc ' config_args='-ds -e -Dprefix=/usr -Dccflags=-g -pipe -Dldflags=-Dman3ext=3pm - Duseithreads -Duseshrplib' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-g -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict- aliasing -I/usr/local/include', optimize='-Os', cppflags='-no-cpp-precomp -g -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -I/usr/local/include' ccversion='', gccversion='3.3 20030304 (Apple Computer, Inc. build 1809)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags ='-L/usr/local/lib' libpth=/usr/local/lib /usr/lib libs=-ldbm -ldl -lm -lc perllibs=-ldl -lm -lc libc=/usr/lib/libc.dylib, so=dylib, useshrplib=true, libperl=libperl.dylib gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-bundle -undefined dynamic_lookup -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT Locally applied patches: 23953 - fix for File::Path::rmtree CAN-2004-0452 security issue 33990 - fix for setuid perl security issues Built under darwin Compiled at Mar 20 2005 16:34:19 %ENV: PERL5LIB="/sw/lib/perl5:/sw/lib/perl5/darwin" @INC: /sw/lib/perl5 /sw/lib/perl5/darwin /System/Library/Perl/5.8.6/darwin-thread-multi-2level /System/Library/Perl/5.8.6 /Library/Perl/5.8.6/darwin-thread-multi-2level /Library/Perl/5.8.6 /Library/Perl /Network/Library/Perl/5.8.6/darwin-thread-multi-2level /Network/Library/Perl/5.8.6 /Network/Library/Perl /System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level /System/Library/Perl/Extras/5.8.6 /Library/Perl/5.8.1 With DBD::mysql 3.0003 or 3.0004 (I don't remember) I was able to run this program with mysql_server_prepare=1 and I was amazed with the improvement in performance. Any advice on how to solve this? Regards, Gustavo Delfino Caracas, Venezuela
From: gdelfino [...] mac.com
I forgot to add the perl crash log file in my report. So I'm attaching it now.
Download perl.crash.log
application/octet-stream 10.8k

Message body not shown because it is not plain text.

From: gdelfino [...] mac.com
I would like to add to my report that using I have compiled a fresh copy of perl 5.8.8 (which defaults to no threads) and I still get the same "Bus error". So maybe this is not related to threads. These are the details of my new perl: $ /usr/local/bin/perl -V Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform: osname=darwin, osvers=8.8.0, archname=darwin-2level uname='darwin gd-powerbook-g4.local 8.8.0 darwin kernel version 8.8.0: fri sep 8 17:18:57 pdt 2006; root:xnu-792.12.6.obj~1release_ppc power macintosh powerpc ' config_args='-de' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing - pipe -Wdeclaration-after-statement -I/usr/local/include -I/opt/local/include', optimize='-O3', cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp-precomp -fno- strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -I/opt/local/ include' ccversion='', gccversion='4.0.0 20041026 (Apple Computer, Inc. build 4061)', gccosandvers='darwin8' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -L/usr/local/lib -L/opt/local/ lib' libpth=/usr/local/lib /opt/local/lib /usr/lib libs=-ldbm -ldl -lm -lc perllibs=-ldl -lm -lc libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false, libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib -L/opt/ local/lib' Characteristics of this binary (from libperl): Compile-time options: PERL_MALLOC_WRAP USE_LARGE_FILES USE_PERLIO Built under darwin Compiled at Oct 8 2006 06:27:17 @INC: /usr/local/lib/perl5/5.8.8/darwin-2level /usr/local/lib/perl5/5.8.8 /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level /usr/local/lib/perl5/site_perl/5.8.8 /usr/local/lib/perl5/site_perl
Gustavo, Hi! Thanks for this information. I have the same version of OSX, except intel. It's a new system that I'm setting up and still don't have a good compile of DBD::mysql due to include library path issues (complains it doesn't know what a 'ulong' is). Are you usign a mysql server that you compiled, or one that's from a binary install? You say your perl isn't threaded, but the include path shows that it is (?) Unfortunately, my OSX setup is new, and I also have a threaded perl, among other issues. If I could get a decent compile, I could test this on my end. I'll try to reproduce this bug today. Thank you! Patrick On Sat Oct 07 12:25:53 2006, gdelfino wrote: Show quoted text
> Hello all, DBD::mysql prepared statements are not working under Mac OS > X 10.4.8. Trying to > use mysql_server_prepare=1 results in a bus error. I have reproduced > this on a PowerBook > G4 and on a dual processor PowerMac G5. Oddly, all the tests are > passing OK. > > All test are passing with mysql_server_prepare=1: > > $ cd ~/src/DBD-mysql-3.0007 > $ export MYSQL_SERVER_PREPARE=1 > $ export SLOW_TESTS=1 > $ make test > PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" > "test_harness(0, 'blib/ > lib', 'blib/arch')" t/*.t > t/00base.............ok > t/10dsnlist..........ok > t/20createdrop.......ok > t/30insertfetch......ok > t/35limit............ok > t/35prepare..........ok > t/40bindparam........ok > t/40bindparam2.......ok > t/40blobs............ok > t/40listfields.......ok > t/40nulls............ok > t/40numrows..........ok > t/41bindparam........ok > t/41blobs_prepare....ok > t/42bindparam........ok > t/50chopblanks.......ok > t/50commit...........ok > t/60leaks............ok > t/dbdadmin...........ok > t/insertid...........ok > t/param_values.......ok > t/prepare_noerror....skipped > all skipped: test - will only run with MySQL 5.1 and above. > t/texecute...........ok > All tests successful, 1 test skipped. > Files=23, Tests=443, 58 wallclock secs (14.84 cusr + 9.45 csys = > 24.29 CPU) > > All test are also passing without mysql_server_prepare=1: > > $ unset MYSQL_SERVER_PREPARE > $ make test > PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" > "test_harness(0, 'blib/ > lib', 'blib/arch')" t/*.t > t/00base.............ok > t/10dsnlist..........ok > t/20createdrop.......ok > t/30insertfetch......ok > t/35limit............ok > t/35prepare..........ok > t/40bindparam........ok > t/40bindparam2.......ok > t/40blobs............ok > t/40listfields.......ok > t/40nulls............ok > t/40numrows..........ok > t/41bindparam........ok > t/41blobs_prepare....ok > t/42bindparam........ok > t/50chopblanks.......ok > t/50commit...........ok > t/60leaks............ok > t/dbdadmin...........ok > t/insertid...........ok > t/param_values.......ok > t/prepare_noerror....skipped > all skipped: test - will only run with MySQL 5.1 and above. > t/texecute...........ok > All tests successful, 1 test skipped. > Files=23, Tests=449, 46 wallclock secs (12.13 cusr + 7.90 csys = > 20.03 CPU) > > Now the details of my program. It is a small script with a single > prepare outside a loop: > > #!/usr/bin/perl > use GD; > use DBI; # Load Database Interface Module > use Data::Dumper; > > # Connect to database > my $dbh = DBI->connect > ('DBI:mysql:database=database_name;host=localhost:mysql_server_prepare=1', > 'myUser', 'myPassword', {RaiseError => 1}) > or die "$0: Can not connect to database: " . $DBI::errstr; > > # create a new image > $im = new GD::Image(6490,4000); > > # allocate color black > $black = $im->colorAllocate(0,0,0); > > # The maximum id value in table is 25958999 > my $sth = $dbh->prepare("SELECT id FROM myTable WHERE id=?"); > > my $id = 1; > foreach $x (0..6489) { > print "x=$x/6490 id=$id\n"; > foreach $y (0..3999){ > $sth->execute($id); > if ($sth->fetchrow_array) { > $im->setPixel($x,$y,$black); > } > $id = $id + 1; > } > open(OUT,">/Users/gdelfino/id.png") or die "can not write output > file"; > binmode OUT; > print OUT $im->png; > close(OUT); > # I wish there were a "tail -f" equivalent for images > } > > When I run it I get the following error: > > $ perl -w id_photo.pl > x=0/6490 id=1 > Bus error > > If I replace mysql_server_prepare=1 with mysql_server_prepare=0, the > program runs just fine > . > > My DBD::mysql version is: > > $ perldoc -m DBD::mysql | grep '$VERSION =' > $VERSION = '3.0007'; > > My DBI version is: > > $ perldoc -m DBI | grep '^$DBI::VERSION' > $DBI::VERSION = "1.52"; > > The version of mysql that I am using is: > > $ mysql --version > mysql Ver 14.7 Distrib 4.1.21, for apple-darwin8.6.0 (powerpc) using > readline 4.3 > > My perl version is: > > $ perl -V > Summary of my perl5 (revision 5 version 8 subversion 6) configuration: > Platform: > osname=darwin, osvers=8.0, archname=darwin-thread-multi-2level > uname='darwin b28.apple.com 8.0 darwin kernel version 7.5.0: thu > mar 3 18:48:46 pst > 2005; root:xnuxnu-517.99.13.obj~1release_ppc power macintosh powerpc ' > config_args='-ds -e -Dprefix=/usr -Dccflags=-g -pipe > -Dldflags=-Dman3ext=3pm - > Duseithreads -Duseshrplib' > hint=recommended, useposix=true, d_sigaction=define > usethreads=define use5005threads=undef useithreads=define > usemultiplicity=define > useperlio=define d_sfio=undef uselargefiles=define usesocks=undef > use64bitint=undef use64bitall=undef uselongdouble=undef > usemymalloc=n, bincompat5005=undef > Compiler: > cc='cc', ccflags ='-g -pipe -fno-common -DPERL_DARWIN > -no-cpp-precomp -fno-strict- > aliasing -I/usr/local/include', > optimize='-Os', > cppflags='-no-cpp-precomp -g -pipe -fno-common -DPERL_DARWIN > -no-cpp-precomp > -fno-strict-aliasing -I/usr/local/include' > ccversion='', gccversion='3.3 20030304 (Apple Computer, Inc. build > 1809)', > gccosandvers='' > intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321 > d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8 > ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', > lseeksize=8 > alignbytes=8, prototype=define > Linker and Libraries: > ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags ='- > L/usr/local/lib' > libpth=/usr/local/lib /usr/lib > libs=-ldbm -ldl -lm -lc > perllibs=-ldl -lm -lc > libc=/usr/lib/libc.dylib, so=dylib, useshrplib=true, > libperl=libperl.dylib > gnulibc_version='' > Dynamic Linking: > dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' ' > cccdlflags=' ', lddlflags='-bundle -undefined dynamic_lookup > -L/usr/local/lib' > > > Characteristics of this binary (from libperl): > Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES > PERL_IMPLICIT_CONTEXT > Locally applied patches: > 23953 - fix for File::Path::rmtree CAN-2004-0452 security > issue > 33990 - fix for setuid perl security issues > Built under darwin > Compiled at Mar 20 2005 16:34:19 > %ENV: > PERL5LIB="/sw/lib/perl5:/sw/lib/perl5/darwin" > @INC: > /sw/lib/perl5 > /sw/lib/perl5/darwin > /System/Library/Perl/5.8.6/darwin-thread-multi-2level > /System/Library/Perl/5.8.6 > /Library/Perl/5.8.6/darwin-thread-multi-2level > /Library/Perl/5.8.6 > /Library/Perl > /Network/Library/Perl/5.8.6/darwin-thread-multi-2level > /Network/Library/Perl/5.8.6 > /Network/Library/Perl > /System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level > /System/Library/Perl/Extras/5.8.6 > /Library/Perl/5.8.1 > > > With DBD::mysql 3.0003 or 3.0004 (I don't remember) I was able to run > this program with > mysql_server_prepare=1 and I was amazed with the improvement in > performance. > > Any advice on how to solve this? > > Regards, > > Gustavo Delfino > Caracas, Venezuela
From: gdelfino [...] mac.com
On Mon Oct 09 09:26:17 2006, CAPTTOFU wrote: Show quoted text
> Are you usign a mysql server that you compiled, or one that's from a binary install?
Hello Patrick, I remember you from oscon 2004, my mysql is a binary install downloaded from mysql.com. This morning I downloaded and installed MySQL 5.0.24a, recompiled DBD::mysql and found that the problem is still present with this newer mysql. I used Mac OS X's perl (threaded). Show quoted text
> You say your perl isn't threaded, but the include path shows that it is (?)
Well, following Dominic Dunlop advice from from the macosx@perl.org mailing list, I downloaded the latest perl from <http://www.cpan.org/src/stable.tar.bz2>. Then I configured and compiled it with default options: sh Configure -de make make test make install According to perl's INSTALL file "The default is to compile without thread support." Anyway, I'll try again. This time on my PowerMac G5. Show quoted text
> Unfortunately, my OSX setup is new, and I also have a threaded perl, > among other issues. If I could get a decent compile, I could test this > on my end. I'll try to reproduce this bug today. > > Thank you! > > Patrick
Patrick, if there is anything I can do to help solve this problem let me know. I am *very* interested in the performance gain of mysql_server_prepare=1. Regards, Gustavo Delfino
Subject: Re: [rt.cpan.org #21946] Server side prepared statements don't work under Mac OS X (Bus error)
Date: Mon, 09 Oct 2006 11:26:53 -0400
To: bug-DBD-mysql [...] rt.cpan.org
From: Patrick Galbraith <patg [...] mysql.com>
Gustavo, Certainly, I want everyone in the community to feel that they can contribute, and am glad to get all the help I can;) Thanks! Patrick Gustavo Delfino via RT wrote: Show quoted text
> Queue: DBD-mysql > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=21946 > > >On Mon Oct 09 09:26:17 2006, CAPTTOFU wrote: > >
>>Are you usign a mysql server that you compiled, or one that's from a binary install? >> >>
> >Hello Patrick, I remember you from oscon 2004, my mysql is a binary install downloaded >from mysql.com. This morning I downloaded and installed MySQL 5.0.24a, recompiled >DBD::mysql and found that the problem is still present with this newer mysql. I used Mac OS >X's perl (threaded). > > >
>>You say your perl isn't threaded, but the include path shows that it is (?) >> >>
> >Well, following Dominic Dunlop advice from from the macosx@perl.org mailing list, I >downloaded the latest perl from <http://www.cpan.org/src/stable.tar.bz2>. Then I >configured and compiled it with default options: > >sh Configure -de >make >make test >make install > >According to perl's INSTALL file "The default is to compile without thread support." > >Anyway, I'll try again. This time on my PowerMac G5. > > >
>>Unfortunately, my OSX setup is new, and I also have a threaded perl, >>among other issues. If I could get a decent compile, I could test this >>on my end. I'll try to reproduce this bug today. >> >>Thank you! >> >>Patrick >> >>
> >Patrick, if there is anything I can do to help solve this problem let me know. I am *very* >interested in the performance gain of mysql_server_prepare=1. > >Regards, > >Gustavo Delfino > >
Thanks for the report! I encountered this same error using a mod_perl app I wrote. This problem was fixed in 3.0008, hence is fixed in the latest 4.00. I tried your test script, but trying to install GD was (and always has been) insurmountable (the compile always fails). Please try your script with the latest, and I am sure you'll find your problem is fixed.