Many of us have been experiencing segfaults on DBI->connect when using the
DBD-mysql
drivers.
I wonder if anyone has found a solution.
I've appended a pretty comprehensive overview of the problem below.
Problem description: Child Apache process segfaults on DBI->connect with
Apache
1.3.12 and Msql-Mysql-modules-1.22{11,12,13,14} (maybe other versions,
too). This
happens with mod_perl versions 1.22 through 1.24. I happen to be running
RedHat
6.1 with egcs-2.91.66, but I've built everything (from Perl to Apache) from
scratch.
Anyway, the point of failure has been found: the MySQL mysql_real_connect()
routine called by Msql-Mysql-modules-1.22{11-14} gets passed a NULL first
arg.
So far nobody has figured out what is going on here, and why this problem
has only now started to crop up. It seemed to appear when I upgraded
mod_perl
to 1.22 and Apache to 1.3.12.
Here's one of my low-level traces. Farther below I offer a DBI->trace(9)
trace,
which shows what's going on from Perl/DBI/DBD's point of view.
> Running Apache with a -X argument yields the following backtrace when my
> mod_perl module does a DBI->connect (str, username, passwd, { options }).
> Note the null mysql argument ------------
> |
> v
> #0 0x80ef5b7 in mysql_real_connect (mysql=0x0,
> host=0x8a99db8 "catlin.cis.brown.edu", user=0x8a9b550 "proxystuff",
> passwd=0x8a9b568 "Kui0-,12!", db=0x8a99e40 "proxysession", port=3306,
> unix_socket=0x0, client_flag=0) at libmysql.c:1125
> #1 0x402d01fd in mysql_dr_connect ()
> from /usr/lib/perl5/site_perl/5.005/i386-linux/auto/DBD/mysql/mysql.so
> #2 0x402d0540 in _MyLogin ()
> from /usr/lib/perl5/site_perl/5.005/i386-linux/auto/DBD/mysql/mysql.so
I really don't know how the null first argument is getting passed to
mysql_real_connect.
Here's a DBI->trace (9) of what's going on. I confess that I don't
understand
most of this output (which comes from my Apache error log file):
> DBI 1.13-nothread dispatch trace level set to 9
> ->
>DBI->Apache::DBI::connect(dbi:mysql:database=proxysession;host=catlin.cis.brown.edu;port=3306,
> proxystuff, Kui0-,12!)
> -> DBI->install_driver(mysql) for perl=5.00503 pid=14122 ruid=99 euid=99
> install_driver: DBD::mysql loaded (version 2.0414)
> New DBI::dr (for DBD::mysql::dr, parent=, id=)
> dbih_setup_handle(DBI::dr=HASH(0x858a0e8)=>DBI::dr=HASH(0x8930414),
>DBD::mysql::dr, 0, Null!)
> dbih_make_com(Null!, DBD::mysql::dr, 84)
> dbih_setup_attrib(DBI::dr=HASH(0x8930414), Err, Null!) SCALAR(0x89259cc) (already
>defined)
> dbih_setup_attrib(DBI::dr=HASH(0x8930414), State, Null!) SCALAR(0x858a3ac)
>(already defined)
> dbih_setup_attrib(DBI::dr=HASH(0x8930414), Errstr, Null!) SCALAR(0x89259e4)
>(already defined)
> dbih_setup_attrib(DBI::dr=HASH(0x8930414), Handlers, Null!) ARRAY(0x89304c8)
>(already defined)
> dbih_setup_attrib(DBI::dr=HASH(0x8930414), Debug, Null!) 0 (already defined) <-
>install_driver= DBI::dr=HASH(0x858a0e8)
> >> FETCH DISPATCH (DBI::dr=HASH(0x8930414) rc2/1 @2 g0 a866b270) at
>/usr/lib/perl5/site_perl/5.005/Apache/DBI.pm line 64.
> <- FETCH= 'mysql' ('Name' from cache) at
>/usr/lib/perl5/site_perl/5.005/Apache/DBI.pm line 64.
> >> connect DISPATCH (DBI::dr=HASH(0x858a0e8) rc1/5 @5 g0 a866b288) at
>/usr/lib/perl5/site_perl/5.005/Apache/DBI.pm line 120.
> -> connect for DBD::mysql::dr (DBI::dr=HASH(0x858a0e8)~0x8930414
>'database=proxysession;host=catlin.cis.brown.edu;port=3306' 'proxystuff' 'pKui0-,12!'
>HASH(0x892441c))
> New DBI::db (for DBD::mysql::db, parent=DBI::dr=HASH(0x8930414),
>id=HASH(0x8930450))
> dbih_setup_handle(DBI::db=HASH(0x89304a4)=>DBI::db=HASH(0x893a058),
>DBD::mysql::db, 8587d60, HASH(0x8930450))
> dbih_make_com(DBI::dr=HASH(0x8930414), DBD::mysql::db, 520)
> dbih_setup_attrib(DBI::db=HASH(0x893a058), Err, DBI::dr=HASH(0x8930414))
>SCALAR(0x89259cc) (already defined)
> dbih_setup_attrib(DBI::db=HASH(0x893a058), State, DBI::dr=HASH(0x8930414))
>SCALAR(0x858a3ac) (already defined)
> dbih_setup_attrib(DBI::db=HASH(0x893a058), Errstr, DBI::dr=HASH(0x8930414))
>SCALAR(0x89259e4) (already defined)
> dbih_setup_attrib(DBI::db=HASH(0x893a058), Handlers, DBI::dr=HASH(0x8930414))
>ARRAY(0x89304c8) (already defined)
> dbih_setup_attrib(DBI::db=HASH(0x893a058), Debug, DBI::dr=HASH(0x8930414)) 0
>(already defined)
> imp_dbh->connect: dsn = database=proxysession;host=catlin.cis.brown.edu;port=3306,
>uid = proxystuff, pwd = Kui0-,12!
> imp_dbh->MyLogin: dbname = proxysession, uid = proxystuff, pwd = Kui0-,12!,host =
>catlin.cis.brown.edu, port = 3306
> imp_dbh->MyConnect: host = catlin.cis.brown.edu, port = 3306, uid = proxystuff,
>pwd = Kui0-,12!
> imp_dbh->MyConnect: client_flags = 0
> [Wed May 17 11:17:29 2000] [notice] child pid 14122 exit signal Segmentation fault
>(11)
--
Richard Goerwitz [EMAIL PROTECTED]