|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-06-17 06:32 UTC] xuefer at 21cn dot com
Description:
------------
lastest apc cvs -r HEAD
just tested 1 time
1 clear get 1 coredump.
#0 add_function (result=0xbfff9e34, op1=0x0, op2=0x0)
at /home/oursky/src/php4/Zend/zend_operators.c:607
607 if (op1->type == IS_ARRAY && op2->type == IS_ARRAY) {
Backtrace:
---------------
#0 add_function (result=0xbfff9e34, op1=0x0, op2=0x0)
at /home/oursky/src/php4/Zend/zend_operators.c:607
#1 0x405373d1 in execute (op_array=0x8345c00)
at /home/oursky/src/php4/Zend/zend_execute.c:1143
#2 0x40746afe in my_execute ()
from /usr/local/lib/php/extensions/no-debug-non-zts-20020429/apc.so
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 16:00:02 2025 UTC |
prove: after execute should not release cache debug: /* {{{ my_execute */ static void my_execute(zend_op_array* op_array TSRMLS_DC) { printf("\nexec start %s\n", op_array->filename); old_execute(op_array TSRMLS_CC); printf("\nexec end %s\n", op_array->filename); ... } test case: test.php <?php while (@ob_end_clean()); echo "in test\n"; include("./test2.php"); echo "in test\n"; ?> test2.php: <?php echo "in test2\n"; ?> run php-with-apc ./test.php result: exec start /t/WebDesign/php4-obj/test.php in test exec start /t/WebDesign/php4-obj/test2.php in test2 exec end /t/WebDesign/php4-obj/test2.php in test exec end /t/WebDesign/php4-obj/test.php so: when exec end /t/WebDesign/php4-obj/test2.php, if cache is released script "echo 'in test';" will give error if it call function in test2.php. e.g. function abc() {} my_execute should not release even 1 cache before disabling the release code in my_execute and with apc_deactivate() patch "apcinfo.php: apc_cache_info();" showing only apcinfo.php Refcount=1, all other scripts refcount=0 when disabled apc_clear_cache() works fine, with no crash apcinfo.php and all it include/requires has refcount=1 sometime other scripts refcount=3 or 4 etc. refcount is fine now complete patch for apc_main.c: Index: apc_main.c =================================================================== RCS file: /repository/pecl/apc/apc_main.c,v retrieving revision 3.8 diff -u -r3.8 apc_main.c --- apc_main.c 25 Mar 2004 18:53:43 -0000 3.8 +++ apc_main.c 21 Jun 2004 10:02:25 -0000 @@ -184,7 +184,7 @@ /* cache the compiler results */ cache_compile_results( key, - h->opened_path, + h->opened_path ? h->opened_path : h->filename, // CGI/CLI have NULL opened_path apc_copy_op_array(NULL, op_array, apc_sma_malloc TSRMLS_CC), apc_copy_new_functions(num_functions, apc_sma_malloc TSRMLS_CC), apc_copy_new_classes(op_array, num_classes, apc_sma_malloc TSRMLS_CC)); @@ -198,6 +198,7 @@ { old_execute(op_array TSRMLS_CC); +#if 0 if (apc_stack_size(APCG(cache_stack)) > 0) { apc_cache_entry_t* cache_entry = (apc_cache_entry_t*) apc_stack_top(APCG(cache_stack)); @@ -208,6 +209,7 @@ apc_cache_release(APCG(cache), cache_entry); } } +#endif } /* }}} */ @@ -277,6 +279,7 @@ int apc_request_shutdown() { + apc_deactivate(); return 0; }3. direct op codes shold be op_array->opcodes about apc_clear_cache: test.php <?php while (@ob_end_clean()); echo "in test\n"; include("./test2.php"); echo "in test\n"; // when sleep, do apc_clear_cache() in another httpd process(must in same cache) sleep(10); call_some_func_in_test2(); // should crash ?> ========== /* compare pointers to determine if op_array's are same */ if (cache_entry->op_array->opcodes == op_array->opcodes) { apc_stack_pop(APCG(cache_stack)); apc_cache_release(APCG(cache), cache_entry); } ========== i don't know when the above if() will be eval to true. but apc_cache_release() should never be called after my_execute() (in php it's include();) >Also, apc serves really no useful purpose being run with >the cli or cgi version. so php.ini has to be config separated so httpd enable apc and cli/cgi disable apc? it's not good.may i ask: ==== /* compare pointers to determine if op_array's are same */ if (cache_entry->op_array->opcodes == op_array->opcodes) { apc_stack_pop(APCG(cache_stack)); apc_cache_release(APCG(cache), cache_entry); } ==== when will this apc_cache_release() is called? i actually don't know reproduce suggestion: if u have lowlevel debug function in C, which cando: inside apc_cache_release(), after released the cache, set the memory block into "unreadable" ---then-----: test case: test.php <?php while (@ob_end_clean()); echo "in test\n"; include("./test2.php"); echo "in test\n"; test2(); // this should produce a memory cannot "READ" error ?> test2.php: <?php echo "in test2\n"; function test2() { echo "in test2\n"; } ?> btw, in mmcache, there's no release after each execute() if apc do release op_array exactly same as Zend do, it should be fine :) read code in Zend/zend_execute.c, there's ZEND_API void execute(zend_op_array *op_array TSRMLS_DC) ...... case ZEND_RETURN: { ...... free_alloca(EX(Ts)); EG(in_execution) = EX(original_in_execution); EG(current_execute_data) = EX(prev_execute_data); return; only tmp vars is released