php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68009 Segmentation fault after calling exit(0) after a request
Submitted: 2014-09-11 18:17 UTC Modified: 2014-09-11 19:13 UTC
From: breedlove dot matt at gmail dot com Assigned: mike (profile)
Status: Closed Package: pecl_http (PECL)
PHP Version: 5.5.16 OS: Debian Wheezy
Private report: No CVE-ID: None
 [2014-09-11 18:17 UTC] breedlove dot matt at gmail dot com
Description:
------------
The following block of code causes a segmentation fault within at least PHP 5.4.32 and 5.5.16-1.


PHP 5.5.16-1~dotdeb.1 (cli) (built: Aug 22 2014 14:18:50) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies


curl 7.26.0:

   SSL => OpenSSL/1.0.1e
   ZLib => 1.2.7
   libSSH => libssh2/1.4.2


http 2.1.1:

   libz => 1.2.7 => 1.2.7
   libcurl => 7.26.0 => 7.26.0
   libevent => 2.0.19-stable => 2.0.19-stable


json: 1.2.1
propro: 1.0.0
raphf: 1.0.4




Test script results in:

Fatal error: Couldn't execute method http\Client::notify in Unknown on line 0
Segmentation fault




Test script:
---------------
$client = new \http\Client;

$client->enableEvents(false);    // Tried this for the hell of it.  Makes no difference.

$request = new \http\Client\Request('GET', 'http://charlotte.craigslist.org/jjj/index.rss');
$client->enqueue($request)->send();
$response = $client->getResponse($request);
exit(0);

Expected result:
----------------
A clean process shutdown.  Please let me know if there is some known circumstance that would justifiably cause this but I would expect PHP to clean-up and shut down properly and I have tried this against multiple PHP versions with the same result.  The example code is just an overly simplified piece sufficient enough to cause the crash.

Actual result:
--------------
GDB backtrace:


warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff7ffa000
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Fatal error: Couldn't execute method http\Client::notify in Unknown on line 0

Program received signal SIGSEGV, Segmentation fault.
0x00000000006c59a6 in destroy_op_array (op_array=0x122ace0) at /usr/src/php5.5/source/php-5.5.16/Zend/zend_opcode.c:364
364     /usr/src/php5.5/source/php-5.5.16/Zend/zend_opcode.c: No such file or directory.
(gdb) bt full
#0  0x00000000006c59a6 in destroy_op_array (op_array=0x122ace0) at /usr/src/php5.5/source/php-5.5.16/Zend/zend_opcode.c:364
        literal = 0x7ffff7e0a4b8
        end = <optimized out>
        i = <optimized out>
#1  0x00000000006de9f8 in zend_hash_destroy (ht=0xea75d0) at /usr/src/php5.5/source/php-5.5.16/Zend/zend_hash.c:560
        p = 0xff94d0
        q = 0x122a8e0
#2  0x00000000006d04e1 in zend_shutdown () at /usr/src/php5.5/source/php-5.5.16/Zend/zend.c:819
No locals.
#3  0x000000000066fc9b in php_module_shutdown () at /usr/src/php5.5/source/php-5.5.16/main/main.c:2384
No locals.
#4  0x0000000000432125 in main (argc=4, argv=0xea6950) at /usr/src/php5.5/source/php-5.5.16/sapi/cli/php_cli.c:1393
        c = <optimized out>
        exit_status = 255
        module_started = 1
        sapi_started = 1
        php_optarg = 0x0
        php_optind = 1
        use_extended_info = 0
        ini_path_override = 0x0
        ini_entries = 0xea6c20 ""
        ini_entries_len = <optimized out>
        ini_ignore = <optimized out>
        sapi_module = <optimized out>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-09-11 19:13 UTC] mike@php.net
-Assigned To: +Assigned To: mike
 [2014-09-15 12:17 UTC] mike@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=pecl/http/pecl_http.git;a=commit;h=ec2582a8084352a9224543ee43fbd060c1ea4d6c
Log: Fixed bug #68009
 [2014-09-15 12:17 UTC] mike@php.net
-Status: Assigned +Status: Closed
 [2014-09-15 12:18 UTC] mike@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=pecl/http/pecl_http.git;a=commit;h=ec2582a8084352a9224543ee43fbd060c1ea4d6c
Log: Fixed bug #68009
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC