Re: Re: APC-3.0.10 issue

From: Date: Tue, 23 May 2006 17:43:35 +0000
Subject: Re: Re: APC-3.0.10 issue
References: 1 2 3 4  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-3797@lists.php.net to get a copy of this message
Sara Golemon wrote:
It'll be helpful to see some more symbols in this frame.... Obviously *something* is not initialized properly. Give these gdb commands a try:
(gdb) p execute_data.opline->op1.u.constant [Ordinary IS_STRING .var = "loaded" .len = 6] (gdb) p execute_data.opline->result.u.var $6 = 1 (gdb) p op_array->T $9 = 340
Well crap, that's unfortunate becuase it all looks (mostly) normal...
bummer...
The op_array is saying it needs 340 temp vars allocated and EX(Ts) has a nice little address somewhere on the stack right about where we'd expect it to be... The op itself, which happens to be the first op in the op_array, is storing its result into temp var #1 (which is well within the 340 limit). What's a little odd is that it's going into #1... not #0 which is what I'd expect from the first op. This doesn't feel like the cause, but it's odd, and odd is all I've got atm.... It's also curious that resolution of this constant *fails* and it's in the fallback string treatment that the actual crash occours. Based on your application logic are you expecting this constant "loaded" to be undefined at the time of its use? Can you share the relevant few lines of code? It would be at the beginning of a function without parameters (at least, none in the delaration -- func_get_args() not withstanding), probably an initial statement like: $foo = loaded; or if (loaded) { or something involving that constant... Include a few subsequent lines of context if you don't mind...
Yeah correct, <?php if (isset($sConf[loaded])) return; .... ?>
-Sara
Just to remove our application from the problem I am re-producing the issue with a simple test script. === start apcinfo.cgi === #!.php <-- just executes a binary that connects to running php <html> <head> <title>APC INFO</title> </head> <body> <?php $order = array(); $cache = apc_cache_info(); if($_GET[clear_apc] == "clear") { apc_clear_cache(); echo "<b>cache cleared!</b>\n"; } echo <<<END_HTML <b>NUM HITS:</b>$cache[num_hits]<br> <b>NUM MISSES:</b>$cache[num_misses]<br> <b>NUM SLOTS:</b>$cache[num_slots]<br> END_HTML; $cnt = 0; foreach($cache['cache_list'] as $c) { $cnt++; $t = date("l M dS, Y, H:i:s",$c[creation_time]); echo "cnt=$cnt num_hits=$c[num_hits] filename=$c[filename] time=$t<br>\n"; } ?> </body> </html> === end apcinfo.cgi === Here is more gdb info === begin gdb dump === (gdb) run -b 127.0.0.1:9968 -c php-4.3.11/phpd.fcgi.dev.ini The program being debugged has been started already. Start it from the beginning? (y or n) y Starting program: php-4.3.11-fastcgi/sapi/cgi/php -b 127.0.0.1:9968 -c php-4.4.2/phpd.fcgi.dev.ini [New LWP 1] [New LWP 2] [New LWP 3] [New LWP 4] [New LWP 5] 20060523 13:11:17 pid=11429 level=apc-debug APC key=0 20060523 13:11:24 pid=11429 level=apc-debug action=APC_OCSTORED path=/html/apcinfo.cgi file=/html/apcinfo.cgi 20060523 13:11:24 pid=11429 file=/html/apcinfo.cgi clock=6,10,0 Program received signal SIGSEGV, Segmentation fault. 0x001c7b80 in execute (op_array=0x7bc580) at php-4.3.11-fastcgi/Zend/zend_execute.c:2034
2034                                            EX(Ts)[EX(opline)->result.u.var].tmp_var = EX(opline)->op1.u.constant;
(gdb) bt #0 0x001c7b80 in execute (op_array=0x7bc580) at php-4.3.11-fastcgi/Zend/zend_execute.c:2034 #1 0x001b0784 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at php-4.3.11-fastcgi/Zend/zend.c:926 #2 0x001850cc in php_execute_script (primary_file=0xffbef8a8) at php-4.3.11-fastcgi/main/main.c:1745 #3 0x001d18c0 in main (argc=5, argv=0xffbef934) at php-4.3.11-fastcgi/sapi/cgi/cgi_main.c:1698 (gdb) f 0 #0 0x001c7b80 in execute (op_array=0x7bc580) at php-4.3.11-fastcgi/Zend/zend_execute.c:2034
2034                                            EX(Ts)[EX(opline)->result.u.var].tmp_var = EX(opline)->op1.u.constant;
(gdb) p execute_data.opline->op1.u.constant $6 = {value = {lval = -218084940, dval = -8.8971649978637714e+245, str = {
     val = 0xf30049b4 "clear_apc", len = 9}, ht = 0xf30049b4, obj = {ce = 0xf30049b4,
     properties = 0x9}}, type = 3 '\003', is_ref = 1 '\001', refcount = 2}
(gdb) p execute_data.opline->op1          $7 = {op_type = 1, u = {constant = {value = {lval = -218084940,
       dval = -8.8971649978637714e+245, str = {val = 0xf30049b4 "clear_apc",
         len = 9}, ht = 0xf30049b4, obj = {ce = 0xf30049b4, properties = 0x9}},
     type = 3 '\003', is_ref = 1 '\001', refcount = 2}, var = 4076882356,
   opline_num = 4076882356, fetch_type = 4076882356, op_array = 0xf30049b4, EA = {
     var = 4076882356, type = 9}}}
(gdb) p execute_data.opline->result.u.var $8 = 7 (gdb) p *execute_data.opline $9 = {opcode = 99 'c', result = {op_type = 2, u = {constant = {value = {lval = 7,
         dval = 1.4853970536756906e-313, str = {
           val = 0x7 <Address 0x7 out of bounds>, len = 0}, ht = 0x7, obj = {
           ce = 0x7, properties = 0x0}}, type = 0 '\0', is_ref = 0 '\0',
       refcount = 0}, var = 7, opline_num = 7, fetch_type = 7, op_array = 0x7, EA = {
       var = 7, type = 0}}}, op1 = {op_type = 1, u = {constant = {value = {
         lval = -218084940, dval = -8.8971649978637714e+245, str = {
           val = 0xf30049b4 "clear_apc", len = 9}, ht = 0xf30049b4, obj = {
           ce = 0xf30049b4, properties = 0x9}}, type = 3 '\003', is_ref = 1 '\001',
       refcount = 2}, var = 4076882356, opline_num = 4076882356,
     fetch_type = 4076882356, op_array = 0xf30049b4, EA = {var = 4076882356,
       type = 9}}}, op2 = {op_type = 8, u = {constant = {value = {lval = 0, dval = 0,
         str = {val = 0x0, len = 0}, ht = 0x0, obj = {ce = 0x0, properties = 0x0}},
       type = 0 '\0', is_ref = 0 '\0', refcount = 0}, var = 0, opline_num = 0,
     fetch_type = 0, op_array = 0x0, EA = {var = 0, type = 0}}}, extended_value = 0,
lineno = 11} (gdb) p execute_data $10 = {opline = 0xf30025cc, function_state = {function_symbol_table = 0xff13a000, function = 0x7bc580, reserved = {0x80000001, 0xffbef110, 0x1b0754, 0x12}}, fbc = 0x0, ce = 0x0, object = {ptr = 0x0}, Ts = 0xffbeeaa0, original_in_execution = 0 '\0', op_array = 0x7bc580, prev_execute_data = 0x0} (gdb) p op_array->T $11 = 41 (gdb) p *op_array $12 = {type = 2 '\002', arg_types = 0x0, function_name = 0x0, refcount = 0xf3002354, opcodes = 0xf3002364, last = 110, size = 110, T = 41, brk_cont_array = 0xf3004efc, last_brk_cont = 1, current_brk_cont = 4294967295, uses_globals = 0 '\0', static_variables = 0x0, start_op = 0x0, backpatch_count = 0, return_reference = 0 '\0', done_pass_two = 1 '\001', filename = 0xf300231c "/html/apcinfo.cgi", reserved = { 0x7263096e, 0x66730962, 0x672c736f, 0x66742c69}} (gdb) === end gdb dump === Not that it's related but figured I would mention that I did make a very minor change to the APC source to fix a bug i initially ran into. diff php_apc.c ../APC-3.0.10.orig/php_apc.c 151c151
< STD_PHP_INI_BOOLEAN("apc.slam_defense", "0",      PHP_INI_SYSTEM, OnUpdateBool,          slam_defense,     zend_apc_globals, apc_globals)
---
STD_PHP_INI_BOOLEAN("apc.slam_defense", "0",      PHP_INI_SYSTEM, OnUpdateInt,          slam_defense,     zend_apc_globals, apc_globals)
I made this change because it is defined as "zend_bool slam_defense;" in apc_globals.h and was giving me a compile error. This fixed my error. Hopefully it did not have an un-intended effect. I imagine the two errors are not related. Thanks again... This has me scratching my head. -James

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