php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65868 AMQPQueue declare should not close the channel when the queue does not exist
Submitted: 2013-10-09 06:19 UTC Modified: 2021-06-10 15:36 UTC
From: ruslan dot talpa at gmail dot com Assigned: cmb (profile)
Status: Closed Package: amqp (PECL)
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2013-10-09 06:19 UTC] ruslan dot talpa at gmail dot com
Description:
------------
If you try to connect to a queue with the AMQP_PASSIVE flag (you do not want to declare the queue if it does not exist) the declare method will throw an error and "close" the channel (amqp_queue.c line 711)
In this particular case (queue does not exist), i am not sure the channel should be closed.

The things are made worse by the fact that AMQPChannel does not have a close() method so you can't "clean up"

This is a problem because in a "worker" where you are processing messages, your communication channel get's closed and you can't reconnect the channel or create a new one (because eventually you run out of available channels)

Solution:
a) don't close the channel when queue does not exist
b) implement a close() method for channel
c) implement a reconnect() method for channel if it's just the "is_connected" is set to 0 but the channel is actually alive


Test script:
---------------
http://jsfiddle.net/DdGmu/1/

Expected result:
----------------
Channels get disconnected and eventually you can't create any more channels


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: Tue Mar 19 05:01:29 2024 UTC