We seem to be dancing around the DBI->connect segfault problem with MySQL
DBI drivers.  Maybe someone here who reads other relevant lists could for-
ward our traffic and see if we can create some synergy there.

Our basic story is that, with Apache 1.3.12 and mod_perl 1.22 (with DBI
version 1.13 and Msql-Mysql-modules-1.2211), many of us are getting seg-
faults when we call DBI->connect.  I happen to be running RedHat 6.1 with
egcs-2.91.66.  Maybe this is a compiler issue.

Anyway, the point of failure has been found: the MySQL mysql_real_connect()
routine called by Msql-Mysql-modules-1.2211 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.

Just to review, here are some relevant portions of our discussion thread.
(As I noted above, it might be really helpful if those with subscriptions
to related lists could repost this information appropriately.)

Relevant quotes:

> 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 ------------
>                                         |
> #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.

Here's one response -

>> 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
>>
>> original code:
>> --------------
>> mysql_init(*sock);
>> 
>> modified:
>> --------------
>> *sock = 0;
>> mysql_init(*sock);

(I'm not sure how well this will work, since the DBI driver for MySQL takes
elaborate measures to pass a pointer to a MYSQL struct into MyConnect, which
then gets initialized by mysql_init.  The DBI driver relies on the
side-effect
of mysql_init initializing its first argument.  So if we manually set *sock
to zero, other stuff might break.)

Richard Goerwitz
Brown University

Reply via email to