php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5994 mysql_pconnect makes apache crash
Submitted: 2000-08-06 20:25 UTC Modified: 2000-08-07 13:00 UTC
From: mahlfors at abo dot fi Assigned:
Status: Closed Package: MySQL related
PHP Version: 4.0.1pl2 OS: Linux 2.2
Private report: No CVE-ID: None
 [2000-08-06 20:25 UTC] mahlfors at abo dot fi
I recently switched from mysql 3.22 to the beta 3.23.21, now apache dumps
core sometimes occasionally and sometimes almost every time I load a page.

The core dump always happens at the mysql_pconnect (or mysql_connect)
request. Some pages which have mysql_pconnect do never crash.

It is of course possible that it is a mysql bug, but I still don't think it should
make php crash.

This does not happen on every page, though.  Mysql reports this:

000806 21:09:05  Aborted connection 15 to db: 'unconnected' user: 'meteli' host: `localhost' (Got an error reading communication packets)

Here's the core dump:

#0  0x400365e1 in mysql_query () from /usr/local/mysql/lib/mysql/libmysqlclient.so.9
#1  0x40034bbb in mysql_real_connect () from /usr/local/mysql/lib/mysql/libmysqlclient.so.9
#2  0x8097287 in php_mysql_do_connect (ht=3, return_value=0x820cfbc, this_ptr=0x0, return_value_used=0, persistent=1) at php_mysql.c:435
#3  0x8097586 in php_if_mysql_pconnect (ht=3, return_value=0x820cfbc, this_ptr=0x0, return_value_used=0) at php_mysql.c:571
#4  0x8105f1c in execute (op_array=0x81ce5ac) at ./zend_execute.c:1558
#5  0x8089bcb in php_execute_script (primary_file=0xbffff91c) at main.c:1157
#6  0x80ec130 in apache_php_module_main (r=0x81f4fdc, fd=19, display_source_mode=0) at sapi_apache.c:93
#7  0x80879ab in send_php ()
#8  0x80879ec in send_parsed_php ()
#9  0x810f613 in ap_invoke_handler ()
#10 0x8122b49 in process_request_internal ()
#11 0x8122bac in ap_process_request ()
#12 0x811a44e in child_main ()
#13 0x811a5dc in make_child ()
#14 0x811a739 in startup_children ()
#15 0x811ad66 in standalone_main ()
#16 0x811b4f3 in main ()
#17 0x4013f9cb in __libc_start_main (main=0x811b1ac <main>, argc=2, argv=0xbffffad4, init=0x8060788 <_init>, fini=0x8148b0c <_fini>, 
    rtld_fini=0x4000ae60 <_dl_fini>, stack_end=0xbffffacc) at ../sysdeps/generic/libc-start.c:92

Marcus Ahlfors / mahlfors@abo.fi

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-06 22:00 UTC] sniper@php.net
Have you recompiled PHP4 after updating MySQL?
And if so, please include your configure line.

--Jani
 [2000-08-07 09:05 UTC] mahlfors at abo dot fi
php4 was configured with something like this:
./configure --with-mysql=/usr/local/mysql \  --with-apache=../apache_1.3.12  \
--enable=track-vars

I upgraded to mysql 3.23.22 but that didn't help. But compiling 
everything (apache/php/mysql) without optimizations and building
php as a module solved the problem. The processor is an 
AMD K6-2/300 if it might have something to do with the optimizations.

Our new configure options where something like (after cflags directives):
./configure --with apxs=/usr/local/apache/bin/apxs\
--with-config-file-path=/usr/local/apache
--with-mysql=/usr/local/mysql \  
--enable=track-vars

 [2000-08-07 13:00 UTC] rasmus@php.net
Sounds like your original mysql client library was linked against pthreads and when you recompiled you got one that wasn't.  This is a known issue and not something we can fix in PHP.  It is a glbc-2.1.x bug.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sun Oct 11 02:00:01 2026 UTC