php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65249 ack() returns true, even if the ack was impossible.
Submitted: 2013-07-12 09:22 UTC Modified: 2021-06-10 15:36 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
 [2013-07-12 09:22 UTC] metamorfozis at metamorfozis dot hu
Description:
------------
According to the reference (http://www.rabbitmq.com/amqp-0-9-1-
reference.html#domain.delivery-tag) a message can be only acked with a delivery 
tag in the same connection and channel.

But if i ack a message with a deliverytag that i received from a different 
connection, it returns true, without any errors, exceptions or returning false.

Test script:
---------------
<?php

[connection setup]

$connection->connect();
$channel=new AMQPChannel($connection);
$q=new AMQPQueue($channel);
$q->setName('ack_test');
$q->declare();

$mode="get";
while (true) {

    if ($mode == "get") {
        print "Waiting for a message...\n";
        $msg=$q->get();
        if ($msg) {
            print "A message arrived. Delivery tag: ".$msg->getDeliveryTag()."\n";
            $mode="reconnect";
        }
    } elseif ($mode == "reconnect") {
        print "Reconnecting...\n";

        $connection->disconnect();
        $connection->connect();
        $mode="ack_old";
    } elseif ($mode == "ack_old") {
        print "Output of ack:\n";
        var_dump($q->ack($msg->getDeliveryTag()));
        exit;
    }
    sleep(1);
}


Expected result:
----------------
$ php -f test_ack_from_different_connection.php
Waiting for a message...
Waiting for a message...
Waiting for a message...
Waiting for a message...
A message arrived. Delivery tag: 1
Reconnecting...
Output of ack:
bool(false)


Actual result:
--------------
$ php -f test_ack_from_different_connection.php
Waiting for a message...
Waiting for a message...
Waiting for a message...
Waiting for a message...
A message arrived. Delivery tag: 1
Reconnecting...
Output of ack:
bool(true)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-06-10 15:36 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-06-10 15:36 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 04:01:28 2024 UTC