Re: removing APC memleak

From: Date: Tue, 29 Apr 2008 03:57:22 +0000
Subject: Re: removing APC memleak
References: 1 2  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-5420@lists.php.net to get a copy of this message
Gopal V wrote: > A race condition was observed there because dst->refcount is really > in shared memory and setting it from multiple processes is prone to > corrupt the value. > > Unless of course, every refcount write used an atomic write/inc macro. > > Something somewhere sets it to zero and then the free calls stomps over > shared memory - but only under high load and once every week or so > (followed by all other procs segv'ing on that). > > And when I say "was" observed, I mean that when we put this leak > in, it stopped segv'ing. Since I can't test it exactly, I'd rather > have that leak than SEGVs. Hi, Fair enough. FYI, I've verified that APC does indeed successfully cache files within a phar archive. Unfortunately, I get a crash on freeing the class default_properties hash table definitions on shutdown in the garbage collection code, and no idea why, backtrace is useless to me, but you smarter folks may be able to do something with it. This is with latest 3.1-dev of APC and PHP_5_3 with pecl/phar CVS, apc and phar as shared modules If you'd like I can send over a sample phar archive that crashes for debugging purposes. Greg #0 0x00002adba75bdb0d in gc_remove_zval_from_buffer (zv=0xb19a20) at /home/cellog/workspace/php5/Zend/zend_gc.h:189 #1 0x00002adba7582cb5 in _zval_ptr_dtor (zval_ptr=0xb196d8, __zend_filename=0x2adba76e9920 "/home/cellog/workspace/php5/Zend/zend_variables.c", __zend_lineno=175) at /home/cellog/workspace/php5/Zend/zend_execute_API.c:421 #2 0x00002adba7593ed4 in _zval_ptr_dtor_wrapper (zval_ptr=0xb196d8) at /home/cellog/workspace/php5/Zend/zend_variables.c:175 #3 0x00002adba75a674f in zend_hash_clean (ht=0x10215f0) at /home/cellog/workspace/php5/Zend/zend_hash.c:552 #4 0x00002adba9cbe4d6 in apc_free_class_entry_after_execution (src=0x1021578) at /home/cellog/workspace/php5/ext/apc/apc_compile.c:2118 #5 0x00002adba9cc034c in apc_deactivate () at /home/cellog/workspace/php5/ext/apc/apc_main.c:599 #6 0x00002adba9cc03e7 in apc_request_shutdown () at /home/cellog/workspace/php5/ext/apc/apc_main.c:625 #7 0x00002adba9cb4add in zm_deactivate_apc (type=1, module_number=30) at /home/cellog/workspace/php5/ext/apc/php_apc.c:308 #8 0x00002adba759ffcc in module_registry_cleanup (module=0x795720) at /home/cellog/workspace/php5/Zend/zend_API.c:2113 #9 0x00002adba75a6c0c in zend_hash_apply (ht=0x2adba79a6b80, apply_func=0x2adba759ff91 <module_registry_cleanup>) at /home/cellog/workspace/php5/Zend/zend_hash.c:673 #10 0x00002adba75959bc in zend_deactivate_modules () at /home/cellog/workspace/php5/Zend/zend.c:874 #11 0x00002adba751615e in php_request_shutdown (dummy=0x0) at /home/cellog/workspace/php5/main/main.c:1497 #12 0x00002adba763b5d5 in php_apache_request_dtor (r=0x947d80) at /home/cellog/workspace/php5/sapi/apache2handler/sapi_apache2.c:470 #13 0x00002adba763c033 in php_handler (r=0x947d80) at /home/cellog/workspace/php5/sapi/apache2handler/sapi_apache2.c:642 #14 0x000000000044392a in ap_run_handler (r=0x947d80) at config.c:152 #15 0x00000000004469c2 in ap_invoke_handler (r=0x947d80) at config.c:364 #16 0x0000000000432698 in ap_process_request (r=0x947d80) at http_request.c:249 #17 0x000000000042d5f0 in ap_process_http_connection (c=0x93de50) at http_core.c:253 #18 0x000000000044ee22 in ap_run_process_connection (c=0x93de50) at connection.c:43 #19 0x0000000000442601 in child_main (child_num_arg=<value optimized out>) at prefork.c:610 #20 0x00000000004427e6 in make_child (s=0x6cea50, slot=0) at prefork.c:650 #21 0x00000000004428c7 in startup_children (number_to_start=5) at prefork.c:722 #22 0x000000000044309c in ap_mpm_run (_pconf=<value optimized out>, plog=<value optimized out>, s=0x6cea50) at prefork.c:941 #23 0x000000000044936e in main (argc=2, argv=0x7fff051b38a8) at main.c:636

« previous php.pecl.dev (#5420) next »