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: -
From: ruslan dot talpa at gmail dot com Assigned:
Status: Open 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:
Package:
Bug Type:
Summary:
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
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

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Nov 12 21:01:36 2019 UTC