|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-08-16 15:41 UTC] david at edeca dot net
Description:
------------
I have a server using PHP 4.4.0 (not available in the 'PHP Version' dropdown!) and Apache 2. APC 3.0.6 seems to work fine for a while and the apc.php status page shows this. For a number of hours the cache will slowly fill up and be fairly unfragmented. However, very suddenly the cache becomes very fragmented and soon PHP will stop serving files. Apache will serve plain HTML or even CGI/Perl but PHP output does not appear.
This issue seems to occur quicker with apc.optimization set to 1, but still occurs with it set to 0. The configuration we are using is given below.
; APC cache
extension=apc.so
apc.enabled = 1
apc.shm_segments = 4
apc.shm_size = 32
apc.optimization = 0
apc.num_files_hint = 1000
apc.gc_ttl = 300
apc.ttl = 3600
#apc.filters=""
#apc.mmap_file_mask=""
apc.slam_defense="0"
apc.file_update_protection="2"
An strace of the crashed process seems to have the following last line:
fcntl64(109, F_SETLKW, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}
If any more debugging output is required, please contact me.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 01:00:01 2025 UTC |
I've managed to get two different backtraces. One appears to occur prior to the other, but that could be a coicindence. Interestingly, they don't include APC in the backtrace. Here they are in order: #0 0x0111fd23 in shutdown_memory_manager (silent=0, clean_cache=0) at /home/onethumb/phpbuilds/php-4.4.0/Zend/zend_alloc.c:490 490 REMOVE_POINTER_FROM_LIST(ptr); (gdb) bt #0 0x0111fd23 in shutdown_memory_manager (silent=0, clean_cache=0) at /home/onethumb/phpbuilds/php-4.4.0/Zend/zend_alloc.c:490 #1 0x01107be9 in php_request_shutdown (dummy=0x0) at /home/onethumb/phpbuilds/php-4.4.0/main/main.c:1008 #2 0x0113bcdc in php_handler (r=0x89385d0) at /home/onethumb/phpbuilds/php-4.4.0/sapi/apache2handler/sapi_apache2.c:572 #3 0x08068625 in ap_run_handler (r=0x89385d0) at /usr/src/redhat/BUILD/httpd-2.0.46/server/config.c:200 #4 0x08068c3f in ap_invoke_handler (r=0x89385d0) at /usr/src/redhat/BUILD/httpd-2.0.46/server/config.c:406 #5 0x08065266 in ap_process_request (r=0x89385d0) at /usr/src/redhat/BUILD/httpd-2.0.46/modules/http/http_request.c:288 #6 0x080608dc in ap_process_http_connection (c=0x8932460) at /usr/src/redhat/BUILD/httpd-2.0.46/modules/http/http_core.c:293 #7 0x08072315 in ap_run_process_connection (c=0x8932460) at /usr/src/redhat/BUILD/httpd-2.0.46/server/connection.c:85 #8 0x08066b01 in child_main (child_num_arg=105) at /usr/src/redhat/BUILD/httpd-2.0.46/server/mpm/prefork/prefork.c:705 #9 0x08066c54 in make_child (s=0x10, slot=82) at /usr/src/redhat/BUILD/httpd-2.0.46/server/mpm/prefork/prefork.c:799 #10 0x08066d76 in startup_children (number_to_start=118) at /usr/src/redhat/BUILD/httpd-2.0.46/server/mpm/prefork/prefork.c:817 #11 0x080675cd in ap_mpm_run (_pconf=0x88270a8, plog=0x8853158, s=0x8828e78) at /usr/src/redhat/BUILD/httpd-2.0.46/server/mpm/prefork/prefork.c:1036 #12 0x0806dbcf in main (argc=1, argv=0xbfffa3c4) at /usr/src/redhat/BUILD/httpd-2.0.46/server/main.c:661 and #0 0x0111f9c2 in _efree (ptr=0xafd73938) at /home/onethumb/phpbuilds/php-4.4.0/Zend/zend_alloc.c:259 259 REMOVE_POINTER_FROM_LIST(p); (gdb) bt #0 0x0111f9c2 in _efree (ptr=0xafd73938) at /home/onethumb/phpbuilds/php-4.4.0/Zend/zend_alloc.c:259 #1 0x01124ef5 in _zval_ptr_dtor (zval_ptr=0x894e920) at /home/onethumb/phpbuilds/php-4.4.0/Zend/zend_execute_API.c:289 #2 0x0112f000 in zend_hash_destroy (ht=0x11cd9cc) at /home/onethumb/phpbuilds/php-4.4.0/Zend/zend_hash.c:556 #3 0x01124d4e in shutdown_executor () at /home/onethumb/phpbuilds/php-4.4.0/Zend/zend_execute_API.c:184 #4 0x0112b3f3 in zend_deactivate () at /home/onethumb/phpbuilds/php-4.4.0/Zend/zend.c:693 #5 0x01107a95 in php_request_shutdown (dummy=0x0) at /home/onethumb/phpbuilds/php-4.4.0/main/main.c:997 #6 0x0113bcdc in php_handler (r=0x893c5e0) at /home/onethumb/phpbuilds/php-4.4.0/sapi/apache2handler/sapi_apache2.c:572 #7 0x08068625 in ap_run_handler (r=0x893c5e0) at /usr/src/debug/httpd-2.0.46/server/config.c:200 #8 0x08068c3f in ap_invoke_handler (r=0x893c5e0) at /usr/src/debug/httpd-2.0.46/server/config.c:406 #9 0x08065266 in ap_process_request (r=0x893c5e0) at /usr/src/debug/httpd-2.0.46/modules/http/http_request.c:288 #10 0x080608dc in ap_process_http_connection (c=0x8932460) at /usr/src/debug/httpd-2.0.46/modules/http/http_core.c:293 #11 0x08072315 in ap_run_process_connection (c=0x8932460) at /usr/src/debug/httpd-2.0.46/server/connection.c:85 #12 0x08066b01 in child_main (child_num_arg=0) at /usr/src/debug/httpd-2.0.46/server/mpm/prefork/prefork.c:705 #13 0x08066c54 in make_child (s=0x18, slot=173) at /usr/src/debug/httpd-2.0.46/server/mpm/prefork/prefork.c:799 #14 0x08066d76 in startup_children (number_to_start=27) at /usr/src/debug/httpd-2.0.46/server/mpm/prefork/prefork.c:817 #15 0x080675cd in ap_mpm_run (_pconf=0x88270a8, plog=0x8853158, s=0x8828e78) at /usr/src/debug/httpd-2.0.46/server/mpm/prefork/prefork.c:1036 #16 0x0806dbcf in main (argc=1, argv=0xbfffa3c4) at /usr/src/debug/httpd-2.0.46/server/main.c:661 Also, we do not see segfaults every time we have a problem. Sometimes the server just stops respond with no segfaults. It's possible that if I gave it time, the segfaults would occur, but I don't have the luxury of letting it sit in a failed state for long periods of time to see what'll happen.Got a 3rd type of seg fault: #0 zend_assign_to_variable (result=0xaf6330b0, op1=0x8e6ab84, op2=0xaf6330d0, value=0x0, type=-2147483647, Ts=0xbffeb2a0) at /home/onethumb/phpbuilds/php-4.4.0/Zend/zend_execute.c:452 452 value->refcount++; (gdb) bt #0 zend_assign_to_variable (result=0xaf6330b0, op1=0x8e6ab84, op2=0xaf6330d0, value=0x0, type=-2147483647, Ts=0xbffeb2a0) at /home/onethumb/phpbuilds/php-4.4.0/Zend/zend_execute.c:452 #1 0x01102ce2 in execute (op_array=0x8dc4524) at /home/onethumb/phpbuilds/php-4.4.0/Zend/zend_execute.c:1390 #2 0x011051d9 in execute (op_array=0x8df1b5c) at /home/onethumb/phpbuilds/php-4.4.0/Zend/zend_execute.c:2258 #3 0x01103ee9 in execute (op_array=0x8e56124) at /home/onethumb/phpbuilds/php-4.4.0/Zend/zend_execute.c:1716 #4 0x01103ee9 in execute (op_array=0x8de038c) at /home/onethumb/phpbuilds/php-4.4.0/Zend/zend_execute.c:1716 #5 0x010f79ff in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /home/onethumb/phpbuilds/php-4.4.0/Zend/zend.c:938 #6 0x010d4ddf in php_execute_script (primary_file=0xbfff97c0) at /home/onethumb/phpbuilds/php-4.4.0/main/main.c:1751 #7 0x01107dac in php_handler (r=0x8d9cf10) at /home/onethumb/phpbuilds/php-4.4.0/sapi/apache2handler/sapi_apache2.c:555 #8 0x08068625 in ap_run_handler (r=0x8d9cf10) at /usr/src/debug/httpd-2.0.46/server/config.c:200 #9 0x08068c3f in ap_invoke_handler (r=0x8d9cf10) at /usr/src/debug/httpd-2.0.46/server/config.c:406 #10 0x080657f5 in ap_internal_redirect (new_uri=0x0, r=0x0) at /usr/src/debug/httpd-2.0.46/modules/http/http_request.c:498 #11 0x0806524c in ap_process_request (r=0x8deb7f0) at /usr/src/debug/httpd-2.0.46/modules/http/http_request.c:301 #12 0x080608dc in ap_process_http_connection (c=0x8d90440) at /usr/src/debug/httpd-2.0.46/modules/http/http_core.c:293 #13 0x08072315 in ap_run_process_connection (c=0x8d90440) at /usr/src/debug/httpd-2.0.46/server/connection.c:85 #14 0x08066b01 in child_main (child_num_arg=0) at /usr/src/debug/httpd-2.0.46/server/mpm/prefork/prefork.c:705 #15 0x08066c54 in make_child (s=0x0, slot=14) at /usr/src/debug/httpd-2.0.46/server/mpm/prefork/prefork.c:799 #16 0x08066d76 in startup_children (number_to_start=186) at /usr/src/debug/httpd-2.0.46/server/mpm/prefork/prefork.c:817 #17 0x080675cd in ap_mpm_run (_pconf=0x8c850a8, plog=0x8cb1158, s=0x8c86e78) at /usr/src/debug/httpd-2.0.46/server/mpm/prefork/prefork.c:1036 #18 0x0806dbcf in main (argc=1, argv=0xbfff9b94) at /usr/src/debug/httpd-2.0.46/server/main.c:661 Still getting plenty of the other two, but just saw a handful of these. I've never really used gdb, so if I'm doing something wrong or could be doing something better, please let me know. Also, do I have to compile APC with something special to get symbols from it and that's why we're not seeing it in the trace? Or are we crashing somewhere else and this isn't an APC bug afterall?Makes very little sense to me, either, but I was fairly methodical tracking it down, and I still haven't had a crash (24 hours). Here's the output: [root@XXX memcache]# od -c /var/www/hostinfo 0000000 < ? \n $ t h i s H o s t = " 0000020 w w w . s m u g m u g . c o m " 0000040 ; \n ? > \n 0000045 FYI, after I'd exhausted everything I knew how to do, I finally went in and put 'trigger_error("some useful error message");' before every big "chunk" of one of my scripts, and then waited for it to crash. I gradually narrowed it down to which functions. Eventually, I had a trigger_error() on every other line inside of a single function, and it errored then segfaulted right before ('require("/var/www/hostinfo");' every time. I removed that line and came up with $thisHost using the hostname of the server in question instead, and now I've been up for 24 hours. Again, it makes no sense to me either, but that's what's going on. And it would take quite some time (minutes at most, but usually at least an hour) before it would crash. I'm happy to give you anything else you might want to know, though.Centos 4u2. php-4.4.1, apc-3.0.8. I have the same random crashed, after restart apache works ok. Here is backtrace: #0 zend_assign_to_variable (result=0xafdb6e9c, op1=Variable "op1" is not available.) at /usr/src/redhat/BUILD/php-4.4.1/Zend/zend_execute.c:452 #1 0x010e0752 in execute (op_array=0x91d02c0) at /usr/src/redhat/BUILD/php-4.4.1/Zend/zend_execute.c:1966 #2 0x010df59c in execute (op_array=0x9248de4) at /usr/src/redhat/BUILD/php-4.4.1/Zend/zend_execute.c:1719 #3 0x010df59c in execute (op_array=0x9242354) at /usr/src/redhat/BUILD/php-4.4.1/Zend/zend_execute.c:1719 #4 0x010d07b0 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /usr/src/redhat/BUILD/php-4.4.1/Zend/zend.c:938 #5 0x010a611e in php_execute_script (primary_file=0xbfe5f3b0) at /usr/src/redhat/BUILD/php-4.4.1/main/main.c:1743 #6 0x010ea442 in php_handler (r=0x924f840) at /usr/src/redhat/BUILD/php-4.4.1/sapi/apache2handler/sapi_apache2.c:572I experienced the same behavior on PHP 5.1.1 and APC 3.0.8. Strace showed the same line: fcntl64(109, F_SETLKW, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0} for crashed processes. But this happened only after updating the source code of the (fairly loaded) server by rsync. Rsync modified ALL the PHP files of the web site (even if they had not changed) and it seemed to create some problems for APC. As a workaround I updated rsync to do checksumming for the files, so now it modifies only the really updated files. APC has no longer crashed. As a conclusion, maybe there is problem with APC if multiple files are edited / changed simultaneously?