503 Error caused by segfault in PHP strpos()

Sindre

Well-Known Member
#1
Hi,

I am struggling with some weird issues on a Magento site. For the most part it works fine, but certain actions cause a 503 error. I have enabled LSAPI core dumps and using gdb I have found the following:

Code:
Core was generated by `lsphp5:/home/<user>/public_html'.
Program terminated with signal 11, Segmentation fault.
#0  0x000000000082fe6d in zend_parse_va_args ()
bt
#0  0x000000000082fe6d in zend_parse_va_args ()
#1  0x0000000000831955 in zend_parse_parameters ()
#2  0x000000000074ed43 in zif_strpos ()
#3  0x000000000089f0fc in zend_do_fcall_common_helper_SPEC ()
#4  0x0000000000892de0 in execute ()
...
I understand this is probably outside LSWS control, however, I wanted to ask here anyway as I know there are a lot of knowledgeable guys around. Is this a bug in PHP or Zend Framework?

I am running LSWS 4.2.20 with LSAPI 6.7. PHP 5.4.37.

Any help is appreciated.
 

Sindre

Well-Known Member
#3
Thanks, I have already seen that but it does not really help much. I have already gotten the core dump and traced this bug to be somehow related to the strpos() function in PHP I think, but I am not really sure where to go from here. I have already run a full yum update and recompiled PHP to no avail. I am not using any opcode cache.
 

Sindre

Well-Known Member
#5
Same result with PHP 5.5.20. Haven't tried 5.6. Here is the gdb backtrace with PHP 5.5:

Code:
Program terminated with signal 11, Segmentation fault.
#0 0x00000000007d1a06 in zend_parse_va_args (num_args=2, type_spec=0x92e49e "sz|l",
va=0x7fff4d6b7030, flags=0) at /usr/local/lsws/phpbuild/php-5.5.20/Zend/zend_API.c:730

#0 0x00000000007d1a06 in zend_parse_va_args (num_args=2, type_spec=0x92e49e "sz|l",
va=0x7fff4d6b7030, flags=0) at /usr/local/lsws/phpbuild/php-5.5.20/Zend/zend_API.c:730
#1 0x00000000007d23c5 in zend_parse_parameters (num_args=2, type_spec=<value optimized out>)
at /usr/local/lsws/phpbuild/php-5.5.20/Zend/zend_API.c:924
#2 0x00000000006f9180 in zif_strpos (ht=<value optimized out>, return_value=0x78a6ff8,
return_value_ptr=<value optimized out>, this_ptr=<value optimized out>,
return_value_used=<value optimized out>)
at /usr/local/lsws/phpbuild/php-5.5.20/ext/standard/string.c:1823
#3 0x0000000000849b03 in zend_do_fcall_common_helper_SPEC (execute_data=<value optimized out>)
at /usr/local/lsws/phpbuild/php-5.5.20/Zend/zend_vm_execute.h:550
#4 0x000000000083b380 in execute_ex (execute_data=0x7902db8)
at /usr/local/lsws/phpbuild/php-5.5.20/Zend/zend_vm_execute.h:363
#5 0x0000000000849fa9 in zend_do_fcall_common_helper_SPEC (execute_data=0x7902640)
at /usr/local/lsws/phpbuild/php-5.5.20/Zend/zend_vm_execute.h:584
#6 0x000000000083b380 in execute_ex (execute_data=0x7902640)
at /usr/local/lsws/phpbuild/php-5.5.20/Zend/zend_vm_execute.h:363
#7 0x00000000007b9efe in zend_call_function (fci=0x7fff4d6b7520,
fci_cache=<value optimized out>)
at /usr/local/lsws/phpbuild/php-5.5.20/Zend/zend_execute_API.c:937
#8 0x00000000007e0017 in zend_call_method (object_pp=0x7fff4d6b7648,
obj_ce=<value optimized out>, fn_proxy=0x41499b0, function_name=0xa69dd6 "__call",
function_name_len=<value optimized out>, retval_ptr_ptr=0x7fff4d6b7658, param_count=2,
arg1=0x78dec48, arg2=0x78de818)
at /usr/local/lsws/phpbuild/php-5.5.20/Zend/zend_interfaces.c:97
#9 0x00000000007ee9ad in zend_std_call_user_call (ht=<value optimized out>,
return_value=0x78a6ec0, return_value_ptr=<value optimized out>, this_ptr=0x41219e0,
return_value_used=<value optimized out>)
I don't think it is caused by a particular Magento extension. It actually happens when I click on a particular customer in the admin backend of Magento. Other customers open just fine.

In any case, a bug in a Magento extension (PHP code) should definitely not cause segfaults within the PHP core/Zend. It should be handled and show an error to the executing script. This definitely looks like a bug to me and I have created a bug report here: https://bugs.php.net/bug.php?id=68958.
 
Top