|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2016-04-06 13:48 UTC] 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)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 13:00:02 2025 UTC |
OS: CentOS 6.6 PHP 7.0.7 (cli) (built: May 25 2016 17:35:28) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans php-fpm[1921] general protection ip:7f5a9454d4c3 sp:7fffb87a8b30 error:0 in opcache.so[7f5a9453a000+2b000] php-fpm[2054] general protection ip:7f5a9454d4c3 sp:7fffb87a8b30 error:0 in opcache.so[7f5a9453a000+2b000]