Bug #71977 [Com]: After opcache turned on to cause Segmentation fault
| From: | jsilver at doublesharp dot com | Date: | Wed, 27 Apr 2016 02:15:10 +0000 |
| Subject: | Bug #71977 [Com]: After opcache turned on to cause Segmentation fault | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-200789@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71977&edit=1
ID: 71977
Comment by: jsilver at doublesharp dot com
Reported by: wangduo1122 at 163 dot com
Summary: After opcache turned on to cause Segmentation fault
Status: Open
Type: Bug
Package: opcache
Operating System: Linux
PHP Version: 7.0.5
Block user comment: N
Private report: N
New Comment:
I was successfully running opcache for some time, but randomly this morning I started seeing the
same behavior from php-fpm. Once these errors began appearing in the log Nginx would only return a
502 Bad Gateway error until php-fpm was restarted.
Removing opcache corrected the issue, please let me know if there is other debugging I can do.
OS: CentOS 7
PHP: 7.0.5
/var/log/php-fpm/www-error.log
--------------------------------
26-Apr-2016 18:26:31] NOTICE: [pool www] child 17467 started
[26-Apr-2016 18:26:34] WARNING: [pool www] child 17344 exited on signal 11 (SIGSEGV) after
205.748769 seconds from start
[26-Apr-2016 18:26:34] NOTICE: [pool www] child 17473 started
[26-Apr-2016 18:26:34] WARNING: [pool www] child 17315 exited on signal 11 (SIGSEGV) after
258.979294 seconds from start
[26-Apr-2016 18:26:34] NOTICE: [pool www] child 17474 started
[26-Apr-2016 18:26:35] WARNING: [pool www] child 17345 exited on signal 11 (SIGSEGV) after
207.569738 seconds from start
[26-Apr-2016 18:26:35] NOTICE: [pool www] child 17476 started
[26-Apr-2016 18:26:38] WARNING: [pool www] child 17317 exited on signal 11 (SIGSEGV) after
263.001353 seconds from start
[26-Apr-2016 18:26:38] NOTICE: [pool www] child 17478 started
[26-Apr-2016 18:26:38] WARNING: [pool www] child 17337 exited on signal 11 (SIGSEGV) after
211.347670 seconds from start
[26-Apr-2016 18:26:38] NOTICE: [pool www] child 17480 started
[26-Apr-2016 18:26:39] WARNING: [pool www] child 17356 exited on signal 11 (SIGSEGV) after
209.634259 seconds from start
[26-Apr-2016 18:26:39] NOTICE: [pool www] child 17482 started
[26-Apr-2016 18:26:41] WARNING: [pool www] child 17343 exited on signal 11 (SIGSEGV) after
213.523122 seconds from start
[26-Apr-2016 18:26:41] NOTICE: [pool www] child 17489 started
[26-Apr-2016 18:26:42] WARNING: [pool www] child 17351 exited on signal 11 (SIGSEGV) after
213.560209 seconds from start
/var/log/messages
--------------------------------
Apr 26 21:26:31 web01 kernel: traps: php-fpm[17316] general protection ip:7f83cb4b6feb
sp:7ffe89bdfdb0 error:0 in opcache.so[7f83cb4a3000+2c000]
Apr 26 21:26:34 web01 kernel: traps: php-fpm[17344] general protection ip:7f83cb4b6feb
sp:7ffe89bdfdb0 error:0 in opcache.so[7f83cb4a3000+2c000]
Apr 26 21:26:34 web01 kernel: traps: php-fpm[17315] general protection ip:7f83cb4b6feb
sp:7ffe89bdf7f0 error:0 in opcache.so[7f83cb4a3000+2c000]
Apr 26 21:26:35 web01 kernel: traps: php-fpm[17345] general protection ip:7f83cb4b6feb
sp:7ffe89bdfdb0 error:0 in opcache.so[7f83cb4a3000+2c000]
Apr 26 21:26:38 web01 kernel: traps: php-fpm[17317] general protection ip:7f83cb4b6feb
sp:7ffe89bdfdb0 error:0 in opcache.so[7f83cb4a3000+2c000]
Apr 26 21:26:38 web01 kernel: traps: php-fpm[17337] general protection ip:7f83cb4b6feb
sp:7ffe89bdfdb0 error:0 in opcache.so[7f83cb4a3000+2c000]
Apr 26 21:26:39 web01 kernel: traps: php-fpm[17356] general protection ip:7f83cb4b6feb
sp:7ffe89bdfdb0 error:0 in opcache.so[7f83cb4a3000+2c000]
Apr 26 21:26:41 web01 kernel: traps: php-fpm[17343] general protection ip:7f83cb4b6feb
sp:7ffe89bdf7f0 error:0 in opcache.so[7f83cb4a3000+2c000]
Apr 26 21:26:42 web01 kernel: traps: php-fpm[17351] general protection ip:7f83cb4b6feb
sp:7ffe89bdf7f0 error:0 in opcache.so[7f83cb4a3000+2c000]
```
Previous Comments:
------------------------------------------------------------------------
[2016-04-08 11:45:17] wangduo1122 at 163 dot com
If you turn off opcache, we would not have this problem.
------------------------------------------------------------------------
[2016-04-07 10:07:34] wangduo1122 at 163 dot com
The original function is accomplished , I do not want to modify the original function .
Test the "a/d", this will not be the original parameters to be modified.
Are there any other ways to solve this problem ?
------------------------------------------------------------------------
[2016-04-07 06:17:01] nikic@php.net
You must
a) declare the parameter as being by-reference in arginfo and
b) separate the argument by using "a/d" instead of "ad".
Does doing these two things fix the issue?
------------------------------------------------------------------------
[2016-04-06 13:48:26] wangduo1122 at 163 dot com
Description:
------------
When turned on opcache, the first call to extension function normally , the second appeared
Segmentation fault. Close opcache is normal.Through debug and found add_assoc_stringl,add_assoc_long
caused Segmentation fault when turned on opcache
Test script:
---------------
ZEND_FUNCTION( L5ApiGetRoute ){
double d_time_out = 0;
std::string err_msg;
zval *za_qos_req;
if ( ZEND_NUM_ARGS() == 2 ){
if ( zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
"ad",&za_qos_req,&d_time_out) == FAILURE ){
RETURN_LONG(-2);
}else{
WRONG_PARAM_COUNT;
RETURN_LONG(-3);
}
php_var_dump(za_qos_req, 1);
add_assoc_stringl( za_qos_req, "hostIp", "10.175.90.28", 12);
add_assoc_long( za_qos_req, "hostPort", 80 );
}
PHP code:
<?php
$l5_req = array(
'modId' => 64100225,
'cmdId' => 65536
);
$l5_time_out = 0.2;
$ret = L5ApiGetRoute($l5_req, $l5_time_out);
print_r($l5_req);
$l5_reqx = array(
'modId' => 64000833,
'key' => 3
);
$ret = L5ApiGetRoute($l5_reqx, $l5_time_out);
print_r($l5_reqx);
?>
PHP.INI(opcache config)
zend_extension=opcache.so
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=10
opcache.fast_shutdown=1
opcache.enable_cli=1
Actual result:
--------------
[root@cweb_sports_api_new_10 ~/cl5/php/src]# /usr/local/qqwebsrv/php7/bin/php test.php
array(2) {
["modId"]=>
int(64100225)
["cmdId"]=>
int(65536)
}
Array
(
[modId] => 64100225
[cmdId] => 65536
[hostIp] => 10.175.90.28
[hostPort] => 80
)
array(2) {---------------------Get the correct parameters
["modId"]=>
int(64000833)
["key"]=>
int(3)
}
Array
(
[modId] => 64000833
[key] => 3
[hostIp] => 10.175.90.28
[hostPort] => 80
)
[root@cweb_sports_api_new_10 ~/cl5/php/src]# /usr/local/qqwebsrv/php7/bin/php test.php
array(2) {
["modId"]=>
int(64100225)
["cmdId"]=>
int(65536)
}
Array
(
[modId] => 64100225
[cmdId] => 65536
[hostIp] => 10.175.90.28
[hostPort] => 80
)
array(32696) {----------------------Did not get to the parameter
Segmentation fault (core dumped)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71977&edit=1