|  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: ruslan dot talpa at gmail dot com
New email:
PHP Version: OS:


 [2013-10-09 06:19 UTC] ruslan dot talpa at gmail dot com
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)

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:

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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-06-10 15:36 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-06-10 15:36 UTC]
The amqp bug tracker is now on Github[1].  If this is still an
issue, please report there.

[1] <>
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Jan 28 14:05:52 2023 UTC