php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62974 Amqp Segmentation fault on teardown
Submitted: 2012-08-30 11:39 UTC Modified: 2012-09-10 05:37 UTC
Votes:7
Avg. Score:5.0 ± 0.0
Reproduced:6 of 6 (100.0%)
Same Version:6 (100.0%)
Same OS:6 (100.0%)
From: mwilliams at webgains dot com Assigned:
Status: Duplicate Package: amqp (PECL)
PHP Version: 5.3.16 OS: CentOS 6.3 Final
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mwilliams at webgains dot com
New email:
PHP Version: OS:

 

 [2012-08-30 11:39 UTC] mwilliams at webgains dot com
Description:
------------
=====================
AMQP version 1.05
PHP version 5.3.16 
CentOS 6.3 Final
=====================

 php -i |grep configure
Configure Command =>  './configure'  '--host=x86_64-unknown-linux-gnu' '--
build=x86_64-unknown-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-
prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--
datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--
libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--
mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' 
'--with-libdir=lib64' '--with-config-file-path=/etc' '--with-config-file-scan-
dir=/etc/php.d' '--enable-debug' '--with-pic' '--disable-rpath' '--without-pear' 
'--with-bz2' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-
dir=/usr' '--with-xpm-dir=/usr' '--enable-gd-native-ttf' '--with-t1lib=/usr' '--
without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' 
'--with-openssl' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--
enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--with-
kerberos' '--enable-ucd-snmp-hack' '--enable-shmop' '--enable-calendar' '--with-
libxml-dir=/usr' '--enable-xml' '--with-system-tzdata' '--with-mhash' '--enable-
force-cgi-redirect' '--libdir=/usr/lib64/php' '--enable-pcntl' '--with-
imap=shared' '--with-imap-ssl' '--enable-mbstring=shared' '--enable-mbregex' '--
with-gd=shared' '--enable-bcmath=shared' '--enable-dba=shared' '--with-db4=/usr' 
'--with-xmlrpc=shared' '--with-ldap=shared' '--with-ldap-sasl' '--enable-
mysqlnd=shared' '--with-mysql=shared,mysqlnd' '--with-mysqli=shared,mysqlnd' '--
with-mysql-sock=/var/lib/mysql/mysql.sock' '--enable-dom=shared' '--with-
pgsql=shared' '--enable-wddx=shared' '--with-snmp=shared,/usr' '--enable-
soap=shared' '--with-xsl=shared,/usr' '--enable-xmlreader=shared' '--enable-
xmlwriter=shared' '--with-curl=shared,/usr' '--enable-fastcgi' '--enable-
pdo=shared' '--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-
mysql=shared,mysqlnd' '--with-pdo-pgsql=shared,/usr' '--with-pdo-
sqlite=shared,/usr' '--with-pdo-dblib=shared,/usr' '--with-sqlite3=shared,/usr' '-
-with-sqlite=shared,/usr' '--enable-json=shared' '--enable-zip=shared' '--without-
readline' '--with-libedit' '--with-pspell=shared' '--enable-phar=shared' '--with-
mcrypt=shared,/usr' '--with-tidy=shared,/usr' '--with-mssql=shared,/usr' '--
enable-sysvmsg=shared' '--enable-sysvshm=shared' '--enable-sysvsem=shared' '--
enable-posix=shared' '--with-unixODBC=shared,/usr' '--enable-fileinfo=shared' '--
enable-intl=shared' '--with-icu-dir=/usr' '--with-enchant=shared,/usr' '--with-
recode=shared,/usr'

===================================

When we run the code (see test script) and it exits early (for any reason) e,g, 
exit; it exits with a segmentation fault.

gdb trace (as far as I got it)

[Thread debugging using libthread_db enabled]
[New Thread 0x7fffdeca1700 (LWP 3772)]
[Thread 0x7fffdeca1700 (LWP 3772) exited]

Program received signal SIGSEGV, Segmentation fault.
0x00007fffee050ef0 in remove_channel_from_connection (connection=0x10e93b0, 
channel=
    0x14b1b80) at /amqp-1.0.5/amqp_connection.c:272
272            if (resource->slots[slot] == channel) { 

Test script:
---------------
$amqp = new AMQPConnection();
$amqp->setHost('localhost');
		
try {
    $amqp->connect();
			
    $channel = new AMQPChannel($amqp);
} catch (AMQPException $e) {
    //DO Something
    throw $e
}
		
$exchange = new AMQPExchange($channel);
$exchange->setName('myexchange');
$exchange->setType(AMQP_EX_TYPE_TOPIC);
$exchange->declare();

exit; //This will cause the segfault

Expected result:
----------------
The script exits.

Actual result:
--------------
Segmentation Fault (Core Dumped)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-08-30 12:44 UTC] aforbes at webgains dot com
If the script above doesn't segfault try:
http://pastebin.com/16Zhv1rW

Removing the exit allows it to finish normally, and commenting out the getExchangeName() function (causing a Fatal call to undefined function) also results in a segfault.
 [2012-09-06 10:34 UTC] bkw at codingforce dot com
Since you're using var_dump in the longer example, I suspect it to be related to 
#62354 and #62953.

Could you check, wether this patch fixes the problem for you?
https://bugs.php.net/patch-display.php?bug_id=62953&patch=print-r.patch&revision=latest
 [2012-09-06 12:15 UTC] aforbes at webgains dot com
We can confirm that this patch has resolved the issue, thanks!
 [2012-09-10 05:37 UTC] pdezwart@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.


 [2012-09-10 05:37 UTC] pdezwart@php.net
-Status: Open +Status: Duplicate
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 05:01:30 2024 UTC