Edit report at https://bugs.php.net/bug.php?id=60078&edit=1

 ID:                 60078
 User updated by:    odou...@php.net
 Reported by:        odou...@php.net
 Summary:            SIGSEGV in xhprof.c
 Status:             Open
 Type:               Bug
 Package:            xhprof
 Operating System:   -
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

More debugging : 

it seems bug is happening in get_cpu_frequency() that returned 0 on line 1335 
so 
array hp_globals.cpu_frequencies is 
wiped out by function clear_frequencies();


Just before, we have an error ("setaffinity: Invalid argument") thrown by line 
1228, so my guess is that function 
bind_to_cpu() failed, and at the end program is segfaulting because this has an 
impact on an array.


Previous Comments:
------------------------------------------------------------------------
[2011-10-17 16:51:21] odou...@php.net

Description:
------------
I'll try to be as precise as possible : 
This happens in a special case that can be reproduced 100%, but I cannot 
provide 
a test 
script (it is using 20MB of closed customer code).

This happens only whith xhprof_enable(). No problem is encountered when the 
module is just 
loaded with no call to xhprof_enable()


In latest clone from git (commit a6bae51236 for file xhprof.c) 
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff3575f49 in hp_mode_shared_endfn_cb (top=0xef0210, symbol=<value 
optimized out>) 
at /usr/src/xhprof/extension/xhprof.c:1553


 bt
#0  hp_mode_shared_endfn_cb (top=0xef0210, symbol=<value optimized out>) at 
/usr/src/xhprof/extension/xhprof.c:1553
#1  0x00007ffff357609e in hp_mode_hier_endfn_cb (entries=<value optimized out>) 
at 
/usr/src/xhprof/extension/xhprof.c:1573
#2  0x00007ffff3576e66 in hp_compile_file (file_handle=<value optimized out>, 
type=8) at 
/usr/src/xhprof/extension/xhprof.c:1721
#3  0x00000000007218a4 in ?? ()
#4  0x000000000071f294 in execute ()
#5  0x00000000006faf7b in zend_execute_scripts ()
#6  0x00000000006b573a in php_execute_script ()
#7  0x0000000000772287 in main ()


Ok so problem is in the function "hp_mode_shared_endfn_cb"

Let's try to see what is the value of each variable here : 

 print /f hp_globals.cpu_frequencies[hp_globals.cur_cpu_id]
Cannot access memory at address 0x0


ok so problem is in this expression.

print hp_globals.cpu_frequencies
$8 = (double *) 0x0
(gdb) print /f hp_globals.cur_cpu_id
$9 = 0


Ok so I can see that hp_globals.cpu_frequencies equals NULL (right ?), and we 
attempt to 
access it as an array.
I read the source code quickly, and I can see that this array should be filled 
at some 
point. Seems it is not.


I made a dirty patch just to avoid the SIGSEGV, but all my timings in xhprof 
reports are 
inaccurate now.




------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=60078&edit=1

Reply via email to