php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65242 AMQPExchange->bind() hangs forever if flags given
Submitted: 2013-07-11 10:14 UTC Modified: 2021-06-10 15:35 UTC
From: metamorfozis at metamorfozis dot hu Assigned: cmb (profile)
Status: Closed Package: amqp (PECL)
PHP Version: Irrelevant OS: ubuntu 12.10
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: metamorfozis at metamorfozis dot hu
New email:
PHP Version: OS:

 

 [2013-07-11 10:14 UTC] metamorfozis at metamorfozis dot hu
Description:
------------
Hello!

Using amqp-1.0.10, on 64bit linux system (tested on different distributions),
AMQPExchange->bind() hangs forever if flags given. So it does not exit, it does 
not proceed, does not print any error, it waits forever.

We have found the solution also:

The problem is that in the bind-s definition:
amqp_exchange.c:
PHP_METHOD(amqp_exchange_class, bind)
{
[...]

int flags;

if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss|l", 
&id, amqp_exchange_class_entry, &src_name, &src_name_len, &keyname, 
&keyname_len, &flags) == FAILURE) {
		return;
	}

[...]

The flags should be declared as long, because it is how it is used later in 
zend_parse_method_parameters.

We have tried, and it works if the int is changed to long.
The problem only occurs on 64 bit systems, on 32bit the problem doesn't comes 
up.





Test script:
---------------
Not works:

$connection->connect();
$channel=new AMQPChannel($connection);
$ex=new AMQPExchange($channel);
$ex->setName('test_exchange');
$ex->setType('topic');
$ex->declare();
print __LINE__."\n";
$ex->bind('amq.direct','test',AMQP_NOWAIT);
print __LINE__."\n";

Works:

$connection->connect();
$channel=new AMQPChannel($connection);
$ex=new AMQPExchange($channel);
$ex->setName('test_exchange');
$ex->setType('topic');
$ex->declare();
print __LINE__."\n";
$ex->bind('amq.direct','test');
print __LINE__."\n";


Expected result:
----------------
Using the examples above:

$ php -f test_bind_notworks.php 
29
31

$ php -f test_bind_notworks.php 
29
31

Actual result:
--------------
Using the examples above:

$ php -f test_bind_notworks.php 
29
^C <--- stalled forewer, needed to press CTRL-C

$ php -f test_bind_notworks.php 
29
31

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-07-11 10:17 UTC] metamorfozis at metamorfozis dot hu
In the expected/actual results it was a copy/paste error, the second file name 
was test_bind_works.php, don't get confused by that.
 [2021-06-10 15:35 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-06-10 15:35 UTC] cmb@php.net
The amqp bug tracker is now on Github[1].  If this is still an
issue, please report there.

[1] <https://github.com/php-amqp/php-amqp/issues>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 00:01:27 2024 UTC