|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57990 php segfault in php_ssh2_channel_stream_close
Submitted: 2008-01-04 05:29 UTC Modified: 2012-06-14 22:30 UTC
From: Assigned:
Status: No Feedback Package: ssh2 (PECL)
PHP Version: 5.2.1 OS: Ubuntu 8.04
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.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2008-01-04 05:29 UTC]
*sometimes* php segfaults when I run my tests on my development box.

I was not able to track down the problem in my php code, as it does not always happen and not always at the same point. It is  perhabs related to the open channels problem (bug #11722), as I have a workaround for it (auto-reconnect after n commands sent) and reducing "n" from 10 to 5 seems also to reduce the number uf segfaults.

Backtrace is below

Actual result:
Core was generated by `/usr/bin/php -d html_errors=off -qC /usr/share/php/phing.php -logger phing.list'.
Program terminated with signal 11, Segmentation fault.
#0  _zend_mm_free_int (heap=0x858b1e8, p=0x3b9b0a89) at /build/buildd/php5-5.2.3/Zend/zend_alloc.c:1921
1921		if (ZEND_MM_IS_FREE_BLOCK(next_block)) {
(gdb) bt
#0  _zend_mm_free_int (heap=0x858b1e8, p=0x3b9b0a89) at /build/buildd/php5-5.2.3/Zend/zend_alloc.c:1921
#1  0xb5f1229b in php_ssh2_channel_stream_close (stream=0xa9b3498, close_handle=1) at /home/berdir/Projekte/ssh2/ssh2-0.10/ssh2_fopen_wrappers.c:58
#2  0x08287a66 in _php_stream_free (stream=0xa9b3498, close_options=11) at /build/buildd/php5-5.2.3/main/streams/streams.c:346
#3  0x08287cc7 in stream_resource_regular_dtor (rsrc=0xa9b13d8) at /build/buildd/php5-5.2.3/main/streams/streams.c:1369
#4  0x082c78b3 in list_entry_destructor (ptr=0xa9b13d8) at /build/buildd/php5-5.2.3/Zend/zend_list.c:184
#5  0x082c5b3d in zend_hash_del_key_or_index (ht=0x858a280, arKey=0x0, nKeyLength=<error type>, h=<error type>, flag=1)
    at /build/buildd/php5-5.2.3/Zend/zend_hash.c:497
#6  0x082c7b4a in _zend_list_delete (id=1434) at /build/buildd/php5-5.2.3/Zend/zend_list.c:58
#7  0x081fb1ff in zif_fclose (ht=1, return_value=0xa9b0b20, return_value_ptr=0x0, this_ptr=0x0, return_value_used=0)
    at /build/buildd/php5-5.2.3/ext/standard/file.c:902
#8  0x082d9071 in execute_internal (execute_data_ptr=0xbfed1eb8, return_value_used=0) at /build/buildd/php5-5.2.3/Zend/zend_execute.c:1373
#9  0xb77a9855 in xdebug_execute_internal (current_execute_data=0xbfed1eb8, return_value_used=0) at /tmp/pear/download/xdebug-2.0.2/xdebug.c:1573
#10 0x082e9bf7 in zend_do_fcall_common_helper_SPEC (execute_data=0xbfed1eb8) at /build/buildd/php5-5.2.3/Zend/zend_vm_execute.h:202
#11 0x082dab98 in execute (op_array=0x9b6201c) at /build/buildd/php5-5.2.3/Zend/zend_vm_execute.h:92
#12 0xb77a94f9 in xdebug_execute (op_array=0x9b6201c) at /tmp/pear/download/xdebug-2.0.2/xdebug.c:1509
#13 0x082e97cb in zend_do_fcall_common_helper_SPEC (execute_data=0xbfed2248) at /build/buildd/php5-5.2.3/Zend/zend_vm_execute.h:234
#14 0x082dab98 in execute (op_array=0x9b650dc) at /build/buildd/php5-5.2.3/Zend/zend_vm_execute.h:92
#15 0xb77a94f9 in xdebug_execute (op_array=0x9b650dc) at /tmp/pear/download/xdebug-2.0.2/xdebug.c:1509
#16 0x082e97cb in zend_do_fcall_common_helper_SPEC (execute_data=0xbfed2cb8) at /build/buildd/php5-5.2.3/Zend/zend_vm_execute.h:234
#17 0x082dab98 in execute (op_array=0xa099e08) at /build/buildd/php5-5.2.3/Zend/zend_vm_execute.h:92
#18 0xb77a94f9 in xdebug_execute (op_array=0xa099e08) at /tmp/pear/download/xdebug-2.0.2/xdebug.c:1509
#19 0x082ae5fa in zend_call_function (fci=0xbfed2ea4, fci_cache=0xbfed2ec8) at /build/buildd/php5-5.2.3/Zend/zend_execute_API.c:975
#20 0x0816bdfb in zim_reflection_method_invoke (ht=1, return_value=0xa9b3708, return_value_ptr=0x0, this_ptr=0xa9b295c, return_value_used=0)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-02-18 15:45 UTC] tim dot g at touchsupport dot com
I too am receiving this same outcome. If you don't mind me asking, what kernel and processor are you running? Mine is as follows:

Kernel: (custom internal build)
Processor: Intel(R) Pentium(R) 4 CPU 2.40GHz

I have another machine with a 2.4.x kernel that isn't experiencing this.
 [2008-05-08 09:33 UTC] skatta72 at luukku dot com
I think I found this one. It's a missing L in Zend/zend_alloc.c:

 define ZEND_MM_LONG_CONST(x)      (x##L)

 In 64bit system it should be

 define ZEND_MM_LONG_CONST(x)      (x##LL)

 I found with gdb that the size - variable was way off where freeing a memory block and the resulting pointer caused the seg fault. Since that change, no crashes.

 This is inside the Zend memory management code. I wouldn't be surprised if it causes many other problems that occur randomly with php on 64-bit platform.
 [2011-09-21 15:20 UTC]
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PECL.

I can't reproduce this, do you have a code that "sometimes" 
reproduces this? :)
 [2011-09-22 12:48 UTC] christopher dot jones at oracle dot com
I opened for the 
ZEND_MM_LONG_CONST patch mentioned here.
 [2011-09-22 13:12 UTC]
Please provide the script you use so we can at least try to 
identify the cause of the crash.
 [2012-06-14 22:30 UTC]
-Status: Feedback +Status: No Feedback
 [2012-06-14 22:30 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Sep 28 10:03:42 2022 UTC