Right, I had the exact same problem. Took me almost 1 day to solve.
I'm using apache 1.3.12 / mod_perl 1.22 / DBI 1.13 / Msql-Mysql-modules 1.22.11
Under normal CGI environment everything works fine but when run with mod_perl
it just segfaults.
As Richard mentioned it's due to a NULL MySQL pointer being passed to the
mysql_init() function of the libmysqlclient library.
I've made a one-line change to the Msql-Mysql-modules-1.2210/mysql/dbdimp.c
at the MyConnect() function, initialize *sock to 0 before sending it to
mysql_init().
original code:
--------------
mysql_init(*sock);
modified:
--------------
*sock = 0;
mysql_init(*sock);
This should take you one step further.
Disclaimer: I do not know why this is happening, probably due to the multi-
processes apache+mod_perl environment. According to the MySQL docs, mysql_init
is supposed to initialize a connection handle for the MySQL struct pointed to
by "MySQL *", if the pointer is null, it'll allocate mem for it.
I'm still experimenting, don't know if this will break anything else!!!
So use with care!!
wil.
--- original message ---
Subject: Re: Segfault on DBI->Connect
Author: [EMAIL PROTECTED]
Date: Tue, 4 Apr 2000 10:19:51 -0400
I've been seeing the same segfault-on-connect problem with Apache 1.2.12
+ mod_perl 1.22 + DBI 1.13 + Msql-Mysql-modules 1.2211. The segfault is
due to a null first argument being passed to mysql_real_connect().
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 "hostname.brown.edu", user=0x8a9b550 "username",
passwd=0x8a9b568 "password", db=0x8a99e40 "databasename", 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
The mysql_real_connect routine does a set_sigpipe(mysql), which triggers
the segfault.
This problem has only come up since I upgraded Apache/mod_perl from
1.3.9/1.21 to 1.3.12/1.22.
Richard Goerwitz
--- original message ---
Subject: Segfault on DBI->Connect
Author: Valter Mazzola <[EMAIL PROTECTED]>
Date: Sat, 01 Apr 2000 18:10:43 CEST
i've a mod_perl script that connect to a mysql db, but sometimes it segfault
on DBI->connect. i'm using Apache::Registry & Apache::DBI for persistend db
connection, use strict and the script it's a package. i've read the docs but
probably i'm missing something.
The persistent DBI connection is ok as i can see from DBI->trace(4)
in the error_log
thank you for your help in advance
valter mazzola, italy
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com