ID: 13437 Updated by: zak Reported By: [EMAIL PROTECTED] Old Status: Open Status: Feedback Bug Type: Reproducible crash Operating System: Linux & Solaris PHP Version: 4.1RC5 New Comment:
Could you try calling apache_child_terminate() at the end of your script? Previous Comments: ------------------------------------------------------------------------ [2001-12-04 10:54:55] [EMAIL PROTECTED] This helps with my problem of apache children being left in unusable states with large memory allocations. However, it is still entirely unreasonable that memory that takes only a few seconds to allocate should need several minutes to be disposed of. I just watched PHP take *six* minutes to dispose of 70 megs of memory it allocated, and on prior occasions when no one was watching, I've found it to have be running for *hours* cleaning up after itself. ------------------------------------------------------------------------ [2001-12-03 17:46:34] [EMAIL PROTECTED] I've seen this as well. The time limit you set is removed when the script finishes but before the memory is cleaned up. What I did to avoid the problem was to change the code in php_request_shutdown() main/main.c. The end of the function looks like: zend_try { shutdown_memory_manager(CG(unclean_shutdown), 0); } zend_end_try(); zend_try { zend_unset_timeout(TSRMLS_C); } zend_end_try(); I switched the timeout and the shutdown, and then it worked for me. It still takes a long time, but you don't get a timeout. Not sure if this is the correct fix, but maybe you want to test and confirm that it helps? ------------------------------------------------------------------------ [2001-12-03 15:58:46] [EMAIL PROTECTED] This problem is still happening on 4.1RC5, though it seems to be doing a little better than before. However it's also ignoring the time value I'm passing in to set_time_limit(), but only when it runs out of time during clean-up. #0 0x8107f05 in _efree (ptr=0xa62065c) at zend_alloc.c:240 240 REMOVE_POINTER_FROM_LIST(p); (gdb) bt #0 0x8107f05 in _efree (ptr=0xa62065c) at zend_alloc.c:240 #1 0x810829b in shutdown_memory_manager (silent=1, clean_cache=1) at zend_alloc.c:469 #2 0x807169e in php_module_shutdown () at main.c:1007 #3 0x8070239 in main (argc=3, argv=0xbffffc44) at cgi_main.c:788 ------------------------------------------------------------------------ [2001-10-10 22:17:21] [EMAIL PROTECTED] Confirmed on Redhat 7.2 No crash, but print_r($us) at the end of this script displays no output. ------------------------------------------------------------------------ [2001-09-25 13:55:55] [EMAIL PROTECTED] When I unserialize a ~7mb object that contains several levels of nested objects and arrays, PHP displays abnormal behavior. (Script #1) First, when script execution is complete, PHP uses 100% of the CPU until it has consumed the limit set by set_time_limit(). At this point, it segfaults with the following backtrace (Backtrace #1). When compiled into Apache, this causes the memory footprint for each child process to skyrocket; the memory is not freed until the child exits. Over time, this has resulted in Apache using 70mb * 10 children = 700mb of RAM. Additonally: I have experienced random crashes when PHP (4.0.4pl1) exits on Solaris. As I can not consistently reproduce this, I can't provide a sample script that always exhibits the problem, but the script that crashes does use mysql, and does NOT use unserialize() at all. This problem is included in this report because both crash in the same function when PHP is doing the same thing (shutting down). Backtrace #1 - Linux / php4-200109251035 ./configure --with-mysql=/usr/local/mysql --enable-track-vars --with-xml --with-imap=/usr --with-zlib-dir=/usr --with-ttf=/usr --enable-bcmath --with-kerberos=/usr/kerberos --with-openssl=/usr Program received signal SIGSEGV, Segmentation fault. 0x80ee455 in _efree (ptr=0xa585b54) at zend_alloc.c:240 240 REMOVE_POINTER_FROM_LIST(p); (gdb) bt #0 0x80ee455 in _efree (ptr=0xa585b54) at zend_alloc.c:240 #1 0x80ee7eb in shutdown_memory_manager (silent=1, clean_cache=1) at zend_alloc.c:469 #2 0x806affe in php_module_shutdown () at main.c:1008 #3 0x8069ba9 in main (argc=2, argv=0xbffffbf4) at cgi_main.c:787 Backtrace #2: Solaris / php 4.0.4pl1 ./configure --with-mysql=/apps/mysql --enable-track-vars --with-xml --enable-bcmath #0 0x89074 in _efree (ptr=0x14d1c0) at zend_alloc.c:232 232 REMOVE_POINTER_FROM_LIST(p); (gdb) bt #0 0x89074 in _efree (ptr=0x14d1c0) at zend_alloc.c:232 #1 0x9ad48 in zend_hash_destroy (ht=0x158008) at zend_hash.c:569 #2 0x962f8 in _zval_dtor (zvalue=0x14a328) at zend_variables.c:69 #3 0x8e9f8 in _zval_ptr_dtor (zval_ptr=0x14acf4) at zend_execute_API.c:261 #4 0x9acdc in zend_hash_destroy (ht=0x11fdf4) at zend_hash.c:564 #5 0x8e824 in shutdown_executor () at zend_execute_API.c:165 #6 0x96ffc in zend_deactivate () at zend.c:525 #7 0x24c38 in php_request_shutdown (dummy=0x0) at main.c:688 #8 0x23a78 in main (argc=3, argv=0xeffffd34) at cgi_main.c:771 Script #1: #!/usr/local/bin/php -q <? set_time_limit(5); $fn = '/path/to/very-lage-serialized.file'; $fd = fopen($fn, 'r'); $str = fread($fd, filesize($fn)); $us = unserialize($str); ?> ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=13437&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]