php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56241 apache segfaults with APC enabled
Submitted: 2004-12-07 20:19 UTC Modified: 2012-07-08 03:31 UTC
From: scott dot fagg at arup dot com Assigned: chx (profile)
Status: Closed Package: APC (PECL)
PHP Version: 4.3.9 OS: linux
Private report: No CVE-ID: None
 [2004-12-07 20:19 UTC] scott dot fagg at arup dot com
Description:
------------
With APC enabled, apache segfaults when creating SOAP/Disco object. Using apache 2.0.50/php 4.3.9 on Fedora Core 2 and apache 1.3.23/php 4.3.9 on redhat 7.3

Note: this bug form doesn't list current versions of PHP!

Reproduce code:
---------------
require_once 'SOAP/Server.php';
require_once 'SOAP/Disco.php';
require_once 'server.php';  /* my server class */

$server = new SOAP_Server;
/* tell server to translate to classes we provide if possible */
$server->_auto_translation = true;

$soapclass = new AMS_SOAP_Server();
$server->addObjectMap($soapclass,'urn:AMS');

if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD']=='POST') 
      { $server->service($HTTP_RAW_POST_DATA); } 
      else 
      { $disco = new SOAP_DISCO_Server($server,'AMS'); }
      


Expected result:
----------------
It should have created an instance of the SOAP_DISCO_Server class.

Actual result:
--------------
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -150536064 (LWP 28311)]
0x006f120c in _int_free () from /lib/tls/libc.so.6
(gdb) bt
#0  0x006f120c in _int_free () from /lib/tls/libc.so.6
#1  0x006f273b in free () from /lib/tls/libc.so.6
#2  0x010efc90 in _efree (ptr=0xa946c0c) at /exports/src/php-4.3.9/Zend/zend_alloc.c:265
#3  0x010fc487 in _zval_dtor (zvalue=0xa63e054) at /exports/src/php-4.3.9/Zend/zend_variables.c:44
#4  0x010f6285 in _zval_ptr_dtor (zval_ptr=0xa63e03c) at /exports/src/php-4.3.9/Zend/zend_execute_API.c:291
#5  0x011016a4 in zend_hash_del_key_or_index (ht=0xa6ead8c, arKey=0xa6e706c "SCHEMA_WSDL", nKeyLength=12,
    h=4104563719, flag=0) at /exports/src/php-4.3.9/Zend/zend_hash.c:527
#6  0x010f63f5 in zval_update_constant (pp=0xfef0129c, arg=0x1)
    at /exports/src/php-4.3.9/Zend/zend_execute_API.c:389
#7  0x01101ba0 in zend_hash_apply_with_argument (ht=0xa63f708, apply_func=0x10f62b0 <zval_update_constant>,
    argument=0x1) at /exports/src/php-4.3.9/Zend/zend_hash.c:720
#8  0x010fe7f6 in _object_and_properties_init (arg=0xa63f8f4, class_type=0xa63f6c8, properties=0x0)
    at /exports/src/php-4.3.9/Zend/zend_API.c:575
#9  0x010fe828 in _object_init_ex (arg=0xa63f8f4, class_type=0xa63f6c8)
    at /exports/src/php-4.3.9/Zend/zend_API.c:594
#10 0x0110af26 in execute (op_array=0xa93205c) at /exports/src/php-4.3.9/Zend/zend_execute.c:2008
#11 0x00f087c6 in my_execute (op_array=0xa93205c) at /home/scott.fagg/APC-2.0.4/apc_main.c:199
#12 0x010fd9f3 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /exports/src/php-4.3.9/Zend/zend.c:891
#13 0x010d6842 in php_execute_script (primary_file=0xfef03c90) at /exports/src/php-4.3.9/main/main.c:1735
#14 0x0110ebe7 in php_handler (r=0xa6201e8) at /exports/src/php-4.3.9/sapi/apache2handler/sapi_apache2.c:540
#15 0x00d54c78 in ap_run_handler () from /usr/sbin/httpd
#16 0x09fcc880 in ?? ()
#17 0x00000000 in ?? ()


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-07 20:44 UTC] scott dot fagg at arup dot com
Here's a simplified test case : 

require_once 'SOAP/Server.php';
require_once 'SOAP/Disco.php';
$server = new SOAP_Server;
$disco = new SOAP_DISCO_Server($server,'kaboom');

Segfault occurs on the last line
 [2004-12-08 01:25 UTC] scott dot fagg at arup dot com
I've been able to workaround the segfault, but moving the 'var' declarations in the SOAP_DISCO_Server class into the constructor method. So i've replaced lines like this from the start of the class: 

var $import_ns = array();

with lines like this in the constructor method :

$this->import_ns = array();

This has stopped the segfault, but probably isn't the solution. The var definitions from the class are : 

var $namespaces     = array(SCHEMA_WSDL => 'wsdl', SCHEMA_SOAP => 'soap');
var $import_ns      = array();
var $wsdl           = '';
var $disco          = '';
var $_wsdl          = array();
var $_disco         = array();
var $_service_name  = '';
var $_service_ns    = '';
var $_service_desc  = '';
var $_portname      = '';
var $_bindingname   = '';
var $soap_server    = NULL;


Interestingly it seems to be the first one that is the culprit, commeting it out, but leaving the others stops the segfaults..
 [2004-12-08 01:29 UTC] rasmus@php.net
Yeah, that one is known.  Using constants in array properties is a problem.  I haven't gotten to it yet.
 [2004-12-08 01:40 UTC] scott dot fagg at arup dot com
Thanks, at least i can work around it for now.

I'm getting 5x - 10x speed improvements, so i'm keen to make use of APC.
 [2012-07-08 03:31 UTC] chx@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: chx
 [2012-07-08 03:31 UTC] chx@php.net
APC bug queue cleaning.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 08:01:30 2024 UTC