From:             [EMAIL PROTECTED]
Operating system: Linux 2.2.19
PHP version:      4.0 Latest CVS (18/04/2001)
PHP Bug Type:     MySQL related
Bug description:  read in violite.c never times out and causes the httpd proc to get 
stuck

Under the lastest CVS and earlier version of php/zend apache httpd processes get stuck 
for 15-30+ minutes in a read located in violite.c to a MySQL server.
 
Example from apache's scoreboard server-status:

Srv PID Acc M CPU  SS Req Conn Child Slot Client VHost Request  
18-0 14908 0/13/13 W  0.17 509 0 0.0 0.01 0.01  134.126.194.180 www.audiogalaxy.com 
GET /list/artistInfo.php?&r=1478&offset=200 HTTP/1.1 

Pid 14908 has been stuck in the "sending data state" for 509 seconds.  This seems to 
only happen on our sessions database and at the same spot everytime.  There is about 
1000 queries/second coming to this db running MySQL 3.33.36.  This bug appears on less 
than 1% of the apache requests, but eats apache slots for lunch requiring a restart or 
a kill -9 issused for each individual pid that is blocked in the read and never woken 
up by the alarm.  This happens on all 21 webservers running 
linux2.2.19/Apache1.3.19/Php4.0.4 or Php latest CVS


Running gdb and doing a backtrace shows whats going on:
Reading symbols from /lib/libnss_dns.so.2...done.
Loaded symbols for /lib/libnss_dns.so.2
0x2ac68424 in __libc_read () from /lib/libc.so.6
(gdb) bt
#0  0x2ac68424 in __libc_read () from /lib/libc.so.6
#1  0x4 in ?? ()
#2  0x8092d63 in my_real_read (net=0x830311c, complen=0x7fffae80) at net.c:458
#3  0x8093014 in my_net_read (net=0x830311c) at net.c:604
#4  0x808e4cc in net_safe_read (mysql=0x830311c) at libmysql.c:288
#5  0x808fdfb in mysql_real_connect (mysql=0x830311c, host=0x83030fc "64.245.54.128", 
    user=0x84b2c54 "private", passwd=0x8302f84 "private", db=0x0, port=1433, 
unix_socket=0x0, 
    client_flag=0) at libmysql.c:1350
#6  0x808b914 in php_mysql_do_connect (ht=3, return_value=0x83030dc, this_ptr=0x0, 
return_value_used=1, 
    persistent=0) at php_mysql.c:575
#7  0x808ba35 in php_if_mysql_connect (ht=3, return_value=0x83030dc, this_ptr=0x0, 
return_value_used=1)
    at php_mysql.c:618
#8  0x811b4d5 in execute (op_array=0x8264b50) at ./zend_execute.c:1494
#9  0x811b692 in execute (op_array=0x82c4278) at ./zend_execute.c:1534
#10 0x811b692 in execute (op_array=0x82649d8) at ./zend_execute.c:1534
#11 0x80e7cde in call_user_function_ex (function_table=0x8205440, object_pp=0x0, 
    function_name=0x8302304, retval_ptr_ptr=0x7ffff798, param_count=2, 
params=0x84c2a44, 
    no_separation=1, symbol_table=0x0) at zend_execute_API.c:464
#12 0x80e76b8 in call_user_function (function_table=0x8205440, object_pp=0x0, 
function_name=0x8302304, 
    retval_ptr=0x8264a74, param_count=2, params=0x7ffff810) at zend_execute_API.c:325
#13 0x80a57a9 in ps_call_handler (func=0x8302304, argc=2, argv=0x7ffff810) at 
mod_user.c:59
#14 0x80a5b68 in ps_write_user (mod_data=0x81da130, key=0x82bf1fc 
"privateprivateprivateprivatepriv", 
    val=0x84c36c4 "privateprivateprivate...session stuff", vallen=335) at 
mod_user.c:147
#15 0x80a3096 in php_session_save_current_state () at session.c:609
#16 0x80a50b5 in php_session_flush () at session.c:1439
#17 0x80a50d7 in php_rshutdown_session (type=1, module_number=14) at session.c:1454
#18 0x80ee695 in module_registry_cleanup (module=0x82280e8) at zend_API.c:785
#19 0x80f1247 in zend_hash_apply (ht=0x81ef400, apply_func=0x80ee668 
<module_registry_cleanup>)
    at zend_hash.c:692
#20 0x80eda39 in zend_deactivate_modules () at zend.c:522
---Type <return> to continue, or q <return> to quit---
#21 0x807effa in php_request_shutdown (dummy=0x0) at main.c:657
#22 0x807d073 in php_apache_request_shutdown ()
#23 0x8125c24 in run_cleanups ()
#24 0x81244de in ap_clear_pool ()
#25 0x812455e in ap_destroy_pool ()
#26 0x81244ca in ap_clear_pool ()
#27 0x8133c35 in child_main ()
#28 0x81342eb in make_child ()
#29 0x813439c in startup_children ()
#30 0x81349eb in standalone_main ()
#31 0x8135207 in main ()
#32 0x2abb0f31 in __libc_start_main (main=0x8134e70 <main>, argc=1, ubp_av=0x7ffffb54, 
    init=0x8065590 <_init>, fini=0x8168fbc <_fini>, rtld_fini=0x2aab9274 <_dl_fini>, 
    stack_end=0x7ffffb4c) at ../sysdeps/generic/libc-start.c:129
(gdb) 
(gdb) up
#1  0x4 in ?? ()
(gdb) up
#2  0x8092d63 in my_real_read (net=0x830311c, complen=0x7fffae80) at net.c:458
458             if ((int) (length=vio_read(net->vio,(char*) pos,remain)) <= 0L)
(gdb) print remain
$1 = 4
(gdb) 


Configure script for php:
./configure --with-mysql --enable-track-vars --with-zlib --with-apache=$apachedir 
--with-gd=$gddir --with-jpeg-dir=$gddir 
--with-config-file-path=/common/globalconfig/php --enable-memory-limit --enable-static

Hope this helps - thanks!


-- 
Edit Bug report at: http://bugs.php.net/?id=10392&edit=1



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to