Bug #17581 Updated: mysql_connect hangs Apache

From: Date: Wed, 12 Jun 2002 19:23:43 +0000
Subject: Bug #17581 Updated: mysql_connect hangs Apache
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-10277@lists.php.net to get a copy of this message
ID: 17581 Updated by: hermannj@slu.edu Reported By: hermannj@slu.edu Status: Feedback Bug Type: Apache related Operating System: Tru64 Unix PHP Version: 4.1.2 New Comment: I upgraded as suggested. Current set up: Apache 1.3.24 PHP 4.2.1 OpenSSL 0.9.6d mod_ssl 2.8.8-1.3.24 etc... However, MySQL has never compiled without errors for me on Tru64 4.0 despite having used the Tru64 install suggestions on MySQL.com. MySQL builtin I ran the same test as described earlier. This time Apache child processes did not hang. I pushed it to a worse scenario having the connect.php script loop the connection attempt 30 times. The total would then become 200x30=6000 attempts. Apache complained but finished the requests and then began terminating child processes normally. Excellent! We'll be moving this to production as soon as we make changes to our PHP code due to new behaviors in PHP 4.2.1. If any problems crop up, I'll submit a report. Thanks for your help. Previous Comments: ------------------------------------------------------------------------ [2002-06-03 14:03:04] mfischer@php.net Does this also occure if you use external libraries? Can you also try to upgrade to 4.2.1, enable with debug (also on apache if possible), and use the strace utility on httpd -X to track down where it actually hangs? Btw, which apache version? ------------------------------------------------------------------------ [2002-06-03 13:52:23] hermannj@slu.edu Apache child processes hang when: 1. A PHP script (let's call it connect.php) sends a mysql_connect request to a MySQL server. 2. The MySQL server is powered down - completely shut off. Example of connect.php: <?php mysql_connect("db","user","pass") || or die("OMG!"); ?> ps ax | grep httpd | wc shows 14 httpd processes After calling http://www.domain.com/connect.php with a browser ps ax | grep httpd | wc shows 15 httpd processes Hitting stop on the browser has no affect. 15 processes remain. After calling /apache/bin/ap -n 200 -c 200 http://www.domain.com/connect.php This will call the script 200 times concurrently. ps ax | grep httpd | wc shows 152 httpd processes (MaxClients reached) Now going to http://www.domain.com/ produces nothing but a timeout. Since there is no mysql_connect timeout, the Apache processe hang indefinately. Result: server hosed! This is much too fragile. Gracefuly restarting Apache has no affect since it is waiting for the child processes to complete. You must stop Apache and start Apache to resume operations. Environment: Tru64 Unix PHP 4.1.2 MySQL builtin libraries ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=17581&edit=1

« previous php.bugs (#10277) next »