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: -
From: metamorfozis at metamorfozis dot hu Assigned:
Status: Open Package: amqp (PECL)
PHP Version: Irrelevant OS: ubuntu 12.10
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [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

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Nov 16 21:01:32 2019 UTC