php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68623 php - switch return - php-fpm SIGSEGV
Submitted: 2014-12-18 17:06 UTC Modified: 2014-12-18 20:09 UTC
From: claude dot ws01 at gmail dot com Assigned:
Status: Closed Package: FPM related
PHP Version: 5.5.19 OS: CentOS 6.6
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: claude dot ws01 at gmail dot com
New email:
PHP Version: OS:

 

 [2014-12-18 17:06 UTC] claude dot ws01 at gmail dot com
Description:
------------
php v5.5.19 centos 6.6 nginx v1.6.2 (tracking sys would not accept 5.5.19 as php version)

Getting a SIGSEGV in php-fpm on the return statement within a switch-case block.
I did not analyse the core dump. But pin-pointed the location in the php code.

A while ago, after updating php, recompiling nginx, I got the same issue, same class, other function, same switch-return concept, that I solved by changing it with an if-then-else.

Last week I did another php update, and then another function caused same SIGSEGV, same class, same switch-return concept, and solved it by putting the return after the switch. 

I'm using same php v5.5.19 in a windows stack and linux server, and this issue is only on the linux server.


I do not know what more information I can provide.

My objective is only to report it, as I have solved it, but worth reporting

Kind regards

Claude.



Test script:
---------------
static function get-a-SIGSEGV-without-any-result-returned()
{
    switch (PHP_OS) {
        case 'WINNT':
            $result =  utf8_encode(strftime($Language->getDateFormatLong(), mktime($hour, $minute, $second, $month, $day, $year)));
            return $result;

        default:
            $result = strftime($Language->getDateFormatLong(), mktime($hour, $minute, $second, $month, $day, $year));
            return $result;
    }
}

static function get-the-result-returned-without-SIGSEGV()
{
    switch (PHP_OS) {
        case 'WINNT':
            $result =  utf8_encode(strftime($Language->getDateFormatLong(), mktime($hour, $minute, $second, $month, $day, $year)));
            break;

        default:
            $result = strftime($Language->getDateFormatLong(), mktime($hour, $minute, $second, $month, $day, $year));
    }
    return $result;
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-12-18 18:46 UTC] aharvey@php.net
-Status: Open +Status: Feedback
 [2014-12-18 18:46 UTC] aharvey@php.net
Please try 5.5.20, which has just been released in the last few hours with a bunch of FPM fixes, and if that doesn't resolve the issue, please provide a backtrace using the instructions at https://bugs.php.net/bugs-generating-backtrace.php.

Thanks!
 [2014-12-18 20:07 UTC] claude dot ws01 at gmail dot com
-Status: Feedback +Status: Open -PHP Version: Irrelevant +PHP Version: 5.5.19
 [2014-12-18 20:07 UTC] claude dot ws01 at gmail dot com
Well, thank you for your quick reply.

This is a bit out of my league, but still I'll followed the lead.

A. Just for your info, after a yum update (on both KVM & OVZ)

php -version
PHP 5.5.19 (cli) (built: Dec 16 2014 14:53:07)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies

(note: before yum update, I had same version but november's built)



B. I run 2 redondant servers (OVZ & KVM)... so they are pretty much identical in php's config, php-fpm as well (I doubled checked)

- I tested KVM with the previously buggy "switch-case-return" and now works like a charm.

- tested same on OVZ, and it did segfault once, maybe twice and then all good (!?!)



C. debuginfo was not all installed, so I did, and ran gdb as described in your pages.
(might not be relevant, but a good exercice for me :))

Here is the backtrace, (just in case the doctor asks me):

==============================================================================
Core was generated by `php-fpm:'.
Program terminated with signal 11, Segmentation fault.
#0  0x00000000005d9434 in zend_std_object_get_class (object=0xecdb18) at /usr/src/debug/php-5.5.19/Zend/zend_object_handlers.c:1498
1498    {
Missing separate debuginfos, use: debuginfo-install GeoIP-1.5.1-5.el6.x86_64 libc-client-2007e-11.el6.x86_64 libidn-1.18-2.el6.x86_64 libmcrypt-2.5.8-9.el6.x86_64 libtool-ltdl-2.2.6-15.5.el6.x86_64 sqlite-3.6.20-1.el6.x86_64
(gdb) bt
#0  0x00000000005d9434 in zend_std_object_get_class (object=0xecdb18) at /usr/src/debug/php-5.5.19/Zend/zend_object_handlers.c:1498
#1  0x00000000005eb45e in ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER (execute_data=0x7fe8d630f918) at /usr/src/debug/php-5.5.19/Zend/zend_vm_execute.h:32786
#2  0x0000000000629918 in execute_ex (execute_data=0x7fe8d630f918) at /usr/src/debug/php-5.5.19/Zend/zend_vm_execute.h:363
#3  0x00000000005a5c2e in dtrace_execute_ex (execute_data=0x7fe8d630f918) at /usr/src/debug/php-5.5.19/Zend/zend_dtrace.c:73
#4  0x0000000000629293 in ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER (execute_data=0x7fe8d630f6b0) at /usr/src/debug/php-5.5.19/Zend/zend_vm_execute.h:8063
#5  0x0000000000629918 in execute_ex (execute_data=0x7fe8d630f6b0) at /usr/src/debug/php-5.5.19/Zend/zend_vm_execute.h:363
#6  0x00000000005a5c2e in dtrace_execute_ex (execute_data=0x7fe8d630f6b0) at /usr/src/debug/php-5.5.19/Zend/zend_dtrace.c:73
#7  0x0000000000629293 in ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER (execute_data=0x7fe8d630f538) at /usr/src/debug/php-5.5.19/Zend/zend_vm_execute.h:8063
#8  0x0000000000629918 in execute_ex (execute_data=0x7fe8d630f538) at /usr/src/debug/php-5.5.19/Zend/zend_vm_execute.h:363
#9  0x00000000005a5c2e in dtrace_execute_ex (execute_data=0x7fe8d630f538) at /usr/src/debug/php-5.5.19/Zend/zend_dtrace.c:73
#10 0x0000000000628cb3 in ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER (execute_data=0x7fe8d630f478) at /usr/src/debug/php-5.5.19/Zend/zend_vm_execute.h:13380
#11 0x0000000000629918 in execute_ex (execute_data=0x7fe8d630f478) at /usr/src/debug/php-5.5.19/Zend/zend_vm_execute.h:363
#12 0x00000000005a5c2e in dtrace_execute_ex (execute_data=0x7fe8d630f478) at /usr/src/debug/php-5.5.19/Zend/zend_dtrace.c:73
#13 0x00000000005b4c2c in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /usr/src/debug/php-5.5.19/Zend/zend.c:1330
#14 0x0000000000555090 in php_execute_script (primary_file=0x7fffd4623980) at /usr/src/debug/php-5.5.19/main/main.c:2506
#15 0x000000000066ed0b in main (argc=<value optimized out>, argv=<value optimized out>) at /usr/src/debug/php-5.5.19/sapi/fpm/fpm/fpm_main.c:1949
==============================================================================
(note: I did not succeed in installing the missing debuginfos)



That's it. Again, thank you for your follow-up.

regards

Claude.
 [2014-12-18 20:09 UTC] claude dot ws01 at gmail dot com
-Status: Open +Status: Closed
 [2014-12-18 20:09 UTC] claude dot ws01 at gmail dot com
Unless you say otherwise, I'll consider that ticket close.
Regards
C.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 06:01:28 2024 UTC