[PHP-BUG] Bug #64827 [NEW]: Segfault in zval_mark_grey (zend_gc.c)
From: odou...@php.net Operating system: Linux PHP version: 5.4.15 Package: *General Issues Bug Type: Bug Bug description:Segfault in zval_mark_grey (zend_gc.c) Description: Bug cannot be reproduced easily, as it requires a Magento install with many products in it. Bug can be reproduced on PHP 5.4.15 and 5.3.25 It does not happen when using cgi mode (only on FastCGI). I assume memory management is not handled equally between these modes. Running a specific page on Magento, page is rendered correctly, but at the end a SIGSEGV happens on PHP process. Program received signal SIGSEGV, Segmentation fault. zval_mark_grey (pz=0x272afb8) at /usr/src/build/php-5.4.15/Zend/zend_gc.c:388 (if needed, you can check source code here : http://svn.php.net/viewvc/php/php- src/trunk/Zend/zend_gc.c?view=markup) Tell me how I can help debug this error, as I cannot provide a reproducible code. Expected result: result page complete with no error Actual result: -- result page complete + SIGSEGV of the process after, which leads to streange behaviour depending on server used (nginx hides the segfault, Apache concatenates a 500 error page if used with mod_fcgid). (gdb) bt #0 zval_mark_grey (pz=0x272afb8) at /usr/src/build/php- 5.4.15/Zend/zend_gc.c:388 #1 0x007fafe5 in zval_mark_grey (pz=0x272afb8) at /usr/src/build/php- 5.4.15/Zend/zend_gc.c:432 #2 0x007fbf05 in gc_mark_roots () at /usr/src/build/php- 5.4.15/Zend/zend_gc.c:501 #3 gc_collect_cycles () at /usr/src/build/php-5.4.15/Zend/zend_gc.c:795 #4 0x007fc290 in gc_zval_possible_root (zv=) at /usr/src/build/php-5.4.15/Zend/zend_gc.c:166 #5 0x007fe297 in zend_object_std_dtor (object=0x390ab38) at /usr/src/build/php-5.4.15/Zend/zend_objects.c:54 #6 0x007fe2c9 in zend_objects_free_object_storage (object=0x272afb8) at /usr/src/build/php- 5.4.15/Zend/zend_objects.c:137 #7 0x0080406b in zend_objects_store_del_ref_by_handle_ex (handle= , handlers=) at /usr/src/build/php-5.4.15/Zend/zend_objects_API.c:221 #8 0x00804093 in zend_objects_store_del_ref (zobject=0x390b088) at /usr/src/build/php- 5.4.15/Zend/zend_objects_API.c:173 #9 0x007ce03d in _zval_dtor (zvalue=) at /usr/src/build/php-5.4.15/Zend/zend_variables.h:35 #10 _zval_ptr_dtor (zval_ptr=0x39781f8) at /usr/src/build/php- 5.4.15/Zend/zend_execute_API.c:438 #11 0x007e9200 in zend_hash_destroy (ht=0x3978130) at /usr/src/build/php-5.4.15/Zend/zend_hash.c:560 #12 0x007db01d in _zval_dtor_func (zvalue=0x390acd0) at /usr/src/build/php-5.4.15/Zend/zend_variables.c:45 #13 0x007ce03d in _zval_dtor (zvalue=) at /usr/src/build/php-5.4.15/Zend/zend_variables.h:35 #14 _zval_ptr_dtor (zval_ptr=0x390d798) at /usr/src/build/php- 5.4.15/Zend/zend_execute_API.c:438 #15 0x007fe297 in zend_object_std_dtor (object=0x38e4fb8) at /usr/src/build/php-5.4.15/Zend/zend_objects.c:54 #16 0x007fe2c9 in zend_objects_free_object_storage (object=0x272afb8) at /usr/src/build/php- 5.4.15/Zend/zend_objects.c:137 #17 0x0080406b in zend_objects_store_del_ref_by_handle_ex (handle= , handlers=) at /usr/src/build/php-5.4.15/Zend/zend_objects_API.c:221 #18 0x00804093 in zend_objects_store_del_ref (zobject=0x3992400) at /usr/src/build/php- 5.4.15/Zend/zend_objects_API.c:173 #19 0x007ce03d in _zval_dtor (zvalue=) at /usr/src/build/php-5.4.15/Zend/zend_variables.h:35 #20 _zval_ptr_dtor (zval_ptr=0x39922f8) at /usr/src/build/php- 5.4.15/Zend/zend_execute_API.c:438 #21 0x007e9200 in zend_hash_destroy (ht=0x2533ab8) at /usr/src/build/php-5.4.15/Zend/zend_hash.c:560 #22 0x007db01d in _zval_dtor_func (zvalue=0x2528948) at /usr/src/build/php-5.4.15/Zend/zend_variables.c:45 #23 0x007ce03d in _zval_dtor (zvalue=) at /usr/src/build/php-5.4.15/Zend/zend_variables.h:35 #24 _zval_ptr_dtor (zval_ptr=0x2518c40) at /usr/src/build/php- 5.4.15/Zend/zend_execute_API.c:438 #25 0x007fe297 in zend_object_std_dtor (object=0x250cd28) at /usr/src/build/php-5.4.15/Zend/zend_objects.c:54 #26 0x007fe2c9 in zend_objects_free_object_storage (object=0x272afb8) at /usr/src/build/php- 5.4.15/Zend/zend_objects.c:137 #27 0x0080406b in zend_objects_store_del_ref_by_handle_ex (handle= , handlers=) at /usr/src/build/php-5.4.15/Zend/zend_objects_API.c:221 #28 0x00804093 in zend_objects_store_del_ref (zobject=0x250cb78) at /usr/src/build/php- 5.4.15/Zend/zend_objects_API.c:173 #29 0x007ce03d in _zval_dtor (zvalue=) at /usr/src/build/php-5.4.15/Zend/zend_variables.h:35 #30 _zval_ptr_dtor (zval_ptr=0x2533c30) at /usr/src/build/php- 5.4.15/Zend/zend_execute_API.c:438 #31 0x007e9200 in zend_hash_destroy (ht=0x2528898) at /usr/src/build/php-5.4.15/Zend/zend_hash.c:560 #32 0x007db01d in _zval_dtor_func (zvalue=0x2523e80) at /usr/src/build/php-5.4.15/Zend/zend_variables.c:45 #33
[PHP-BUG] Bug #52378 [NEW]: new DateTime(time()) failed and should not
From: Operating system: PHP version: 5.3.2 Package: Date/time related Bug Type: Bug Bug description:new DateTime(time()) failed and should not Description: Creating a new DateTime object with a unix timestamp failed with error Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (1279547855) at position 8 (5): Unexpected character' If this is expected behaviour, this should be written in documentation and DateTime::setTimestamp() should be fixed: http://www.php.net/manual/en/datetime.settimestamp.php#Notes "Passing a Unix timestamp to DateTime::__construct() is an alternative when using PHP 5.2." Test script: --- http://bugs.php.net/bug.php?id=52378&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52378&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52378&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52378&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=52378&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52378&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=52378&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=52378&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=52378&r=needscript Try newer version: http://bugs.php.net/fix.php?id=52378&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=52378&r=support Expected behavior: http://bugs.php.net/fix.php?id=52378&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=52378&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=52378&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=52378&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52378&r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=52378&r=dst IIS Stability: http://bugs.php.net/fix.php?id=52378&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=52378&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=52378&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=52378&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=52378&r=mysqlcfg
[PHP-BUG] Bug #51238 [NEW]: Segfault with preg_replace
From: Operating system: all PHP version: 5.3.2 Package: PCRE related Bug Type: Bug Bug description:Segfault with preg_replace Description: You can make a segfault with a particular regexp (that appears to be used in Mysqli, or in Zend Framework at least). This bug appears on : PHP 5.3.2 PHP 5.2.10 PHP 4 with internal pcrelib of course. NOTE: I cannot reproduce this bug everytime. Once in a while, the segfault is not triggered (weird ...). NOTE 2: Same bug (segfault) with preg_match or preg_match_all Test script: --- ..., ecode=0x8dcd78e "_", mstart=0xb7508c64 "'", 'a' ..., offset_top=4, md=0xbfdced54, ims=0, eptrb=0x0, flags=0, rdepth=20133) at /usr/src/php/php-5.3.2/ext/pcre/pcrelib/pcre_exec.c:454 454 { #0 match (eptr=0xb750b3b7 'a' ..., ecode=0x8dcd78e "_", mstart=0xb7508c64 "'", 'a' ..., offset_top=4, md=0xbfdced54, ims=0, eptrb=0x0, flags=0, rdepth=20133) at /usr/src/php/php-5.3.2/ext/pcre/pcrelib/pcre_exec.c:454 #1 0x080ebc9a in match (eptr=Variable "eptr" is not available. ) at /usr/src/php/php-5.3.2/ext/pcre/pcrelib/pcre_exec.c:1533 #2 0x080e78f4 in match (eptr=Variable "eptr" is not available. ) at /usr/src/php/php-5.3.2/ext/pcre/pcrelib/pcre_exec.c:734 #3 0x080ebc9a in match (eptr=Variable "eptr" is not available. ) at /usr/src/php/php-5.3.2/ext/pcre/pcrelib/pcre_exec.c:1533 #4 0x080e78f4 in match (eptr=Variable "eptr" is not available. ) at /usr/src/php/php-5.3.2/ext/pcre/pcrelib/pcre_exec.c:734 #5 0x080ebc9a in match (eptr=Variable "eptr" is not available. ) at /usr/src/php/php-5.3.2/ext/pcre/pcrelib/pcre_exec.c:1533 #6 0x080e78f4 in match (eptr=Variable "eptr" is not available. ) at /usr/src/php/php-5.3.2/ext/pcre/pcrelib/pcre_exec.c:734 [ ... snip because backtrace shows what appears to be a loop ... ] #20131 0x080ebc9a in match (eptr=Variable "eptr" is not available. ) at /usr/src/php/php-5.3.2/ext/pcre/pcrelib/pcre_exec.c:1533 #20132 0x080e78f4 in match (eptr=Variable "eptr" is not available. ) at /usr/src/php/php-5.3.2/ext/pcre/pcrelib/pcre_exec.c:734 #20133 0x080e7df8 in match (eptr=Variable "eptr" is not available. ) at /usr/src/php/php-5.3.2/ext/pcre/pcrelib/pcre_exec.c:1395 #20134 0x080f235a in php_pcre_exec (argument_re=0x8dcd760, extra_data=0xbfdceef4, subject=0xb7508c64 "'", 'a' ..., length=50001, start_offset=0, options=Variable "options" is not available. ) at /usr/src/php/php-5.3.2/ext/pcre/pcrelib/pcre_exec.c:5641 #20135 0x080f62a9 in php_pcre_replace_impl (pce=0x8dcd8f8, subject=0xb7508c64 "'", 'a' ..., subject_len=50001, replace_val=0xb74fad54, is_callable_replace=0, result_len=0xbfdcf088, limit=-1, replace_count=0xbfdcf074) at /usr/src/php/php-5.3.2/ext/pcre/php_pcre.c:1040 #20136 0x080f6fc5 in php_pcre_replace (regex=0xb74fb284 "/'('|{2}|[^'])*'/", regex_len=21, subject=0xb7508c64 "'", 'a' ..., subject_len=50001, replace_val=0xb74fad54, is_callable_replace=0, result_len=0xbfdcf088, limit=-1, replace_count=0xbfdcf074) at /usr/src/php/php-5.3.2/ext/pcre/php_pcre.c:950 #20137 0x080f7542 in php_replace_in_subject (regex=0xb74fad70, replace=Variable "replace" is not available. ) at /usr/src/php/php-5.3.2/ext/pcre/php_pcre.c:1267 #20138 0x080f7bb6 in preg_replace_impl (ht=Variable "ht" is not available. ) at /usr/src/php/php-5.3.2/ext/pcre/php_pcre.c:1365 #20139 0x084b3c81 in zend_do_fcall_common_helper_SPEC (execute_data=0xb7470028) at zend_vm_execute.h:313 #20140 0x084acf86 in execute (op_array=0xb74fb1ec) at zend_vm_execute.h:104 #20141 0x08484fe6 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /usr/src/php/php-5.3.2/Zend/zend.c:1194 #20142 0x0842c036 in php_execute_script (primary_file=0xbfdd16f4) at /usr/src/php/php-5.3.2/main/main.c:2260 #20143 0x085157e8 in main (argc=2, argv=0xbfdd1854) at /usr/src/php/php-5.3.2/sapi/cli/php_cli.c:1192 -- Edit bug report at http://bugs.php.net/bug.php?id=51238&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51238&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51238&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51238&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=51238&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51238&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=51238&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=51238&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=51238&r=needscript Try newer version: http://bugs.php.net/fix.php?id=51238&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=51238&r=support Expected behavior: http://bugs.php.net/fix.php?id=51238&r=notwrong Not enough in
[PHP-BUG] Bug #60078 [NEW]: SIGSEGV in xhprof.c
From: Operating system: - PHP version: Irrelevant Package: xhprof Bug Type: Bug Bug description:SIGSEGV in xhprof.c 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. 0x73575f49 in hp_mode_shared_endfn_cb (top=0xef0210, symbol=) at /usr/src/xhprof/extension/xhprof.c:1553 bt #0 hp_mode_shared_endfn_cb (top=0xef0210, symbol=) at /usr/src/xhprof/extension/xhprof.c:1553 #1 0x7357609e in hp_mode_hier_endfn_cb (entries=) at /usr/src/xhprof/extension/xhprof.c:1573 #2 0x73576e66 in hp_compile_file (file_handle=, type=8) at /usr/src/xhprof/extension/xhprof.c:1721 #3 0x007218a4 in ?? () #4 0x0071f294 in execute () #5 0x006faf7b in zend_execute_scripts () #6 0x006b573a in php_execute_script () #7 0x00772287 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 bug report at https://bugs.php.net/bug.php?id=60078&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60078&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60078&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60078&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=60078&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60078&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=60078&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=60078&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=60078&r=needscript Try newer version: https://bugs.php.net/fix.php?id=60078&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=60078&r=support Expected behavior: https://bugs.php.net/fix.php?id=60078&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=60078&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=60078&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=60078&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60078&r=php4 Daylight Savings:https://bugs.php.net/fix.php?id=60078&r=dst IIS Stability: https://bugs.php.net/fix.php?id=60078&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=60078&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=60078&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=60078&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=60078&r=mysqlcfg
Bug #60078 [Opn]: SIGSEGV in xhprof.c
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. 0x73575f49 in hp_mode_shared_endfn_cb (top=0xef0210, symbol=) at /usr/src/xhprof/extension/xhprof.c:1553 bt #0 hp_mode_shared_endfn_cb (top=0xef0210, symbol=) at /usr/src/xhprof/extension/xhprof.c:1553 #1 0x7357609e in hp_mode_hier_endfn_cb (entries=) at /usr/src/xhprof/extension/xhprof.c:1573 #2 0x73576e66 in hp_compile_file (file_handle=, type=8) at /usr/src/xhprof/extension/xhprof.c:1721 #3 0x007218a4 in ?? () #4 0x0071f294 in execute () #5 0x006faf7b in zend_execute_scripts () #6 0x006b573a in php_execute_script () #7 0x00772287 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
Bug #60078 [Opn]: SIGSEGV in xhprof.c
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: System is Linux 64 x64 (kernel 2.6.36) Bi CPU Intel(R) Xeon(R) CPU L5630 @ 2.13GHz I found this bug on a particular machine where some CPUs are deactivated on purpose (sorry, this is a major information but I only detected it now). Command used to deactivate a thread: echo 0 > /sys/devices/system/cpu/cpu1/online function bind_to_cpu failed for cpu 1, and now I can see why. Do you have any idea how to handle this on xhprof ? Maybe not resetting the whole hp_globals.cpu_frequencies array if bind_ failed ? Previous Comments: [2011-10-19 17:39:26] scott...@php.net Any more information about the OS or version of PHP? I have this working fine on OS X with PHP 5.3 and PHP 5.4. [2011-10-18 13:22:27] odou...@php.net 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. [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. 0x73575f49 in hp_mode_shared_endfn_cb (top=0xef0210, symbol=) at /usr/src/xhprof/extension/xhprof.c:1553 bt #0 hp_mode_shared_endfn_cb (top=0xef0210, symbol=) at /usr/src/xhprof/extension/xhprof.c:1553 #1 0x7357609e in hp_mode_hier_endfn_cb (entries=) at /usr/src/xhprof/extension/xhprof.c:1573 #2 0x73576e66 in hp_compile_file (file_handle=, type=8) at /usr/src/xhprof/extension/xhprof.c:1721 #3 0x007218a4 in ?? () #4 0x0071f294 in execute () #5 0x006faf7b in zend_execute_scripts () #6 0x006b573a in php_execute_script () #7 0x00772287 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
Bug #60078 [Opn]: SIGSEGV in xhprof.c
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: I created a patch for this (tested successfully) : https://github.com/olivierd/xhprof/commit/2e74533746bf14b0bcfc9a6fae08e1bf9b4f724b Previous Comments: [2011-10-19 17:45:05] odou...@php.net System is Linux 64 x64 (kernel 2.6.36) Bi CPU Intel(R) Xeon(R) CPU L5630 @ 2.13GHz I found this bug on a particular machine where some CPUs are deactivated on purpose (sorry, this is a major information but I only detected it now). Command used to deactivate a thread: echo 0 > /sys/devices/system/cpu/cpu1/online function bind_to_cpu failed for cpu 1, and now I can see why. Do you have any idea how to handle this on xhprof ? Maybe not resetting the whole hp_globals.cpu_frequencies array if bind_ failed ? [2011-10-19 17:39:26] scott...@php.net Any more information about the OS or version of PHP? I have this working fine on OS X with PHP 5.3 and PHP 5.4. [2011-10-18 13:22:27] odou...@php.net 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. [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. 0x73575f49 in hp_mode_shared_endfn_cb (top=0xef0210, symbol=) at /usr/src/xhprof/extension/xhprof.c:1553 bt #0 hp_mode_shared_endfn_cb (top=0xef0210, symbol=) at /usr/src/xhprof/extension/xhprof.c:1553 #1 0x7357609e in hp_mode_hier_endfn_cb (entries=) at /usr/src/xhprof/extension/xhprof.c:1573 #2 0x73576e66 in hp_compile_file (file_handle=, type=8) at /usr/src/xhprof/extension/xhprof.c:1721 #3 0x007218a4 in ?? () #4 0x0071f294 in execute () #5 0x006faf7b in zend_execute_scripts () #6 0x006b573a in php_execute_script () #7 0x00772287 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