Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection closed issue #12

Closed
noldus opened this issue Jun 19, 2012 · 4 comments
Closed

Connection closed issue #12

noldus opened this issue Jun 19, 2012 · 4 comments
Assignees
Labels

Comments

@noldus
Copy link

noldus commented Jun 19, 2012

We are using the latest version of the SimpleAmqpClient and we ran into problems when the connection of a consumer to the RabbitMQ server is (force) closed on the peer end.

Scenario

We start a consumer and have it consume messages by calling 'Channel::BasicConsumeMessage'. When there are no messages, the function just waits. If we now force close the connection on the RabbitMQ server, the exception ConnectionForcedException is thrown. This exception class has AmqpException as its very base class. However, during the construction of AmqpException another error (0xC0000005 access violation) occurs, because the function 'amqp_method_name' returns a NULL pointer. See the constructor of AmqpException below:

AmqpException::AmqpException(const std::string& reply_text, boost::uint16_t class_id, boost::uint16_t method_id) throw() :
std::runtime_error(std::string(amqp_method_name((class_id << 16) | method_id)).append(" caused: ").append(reply_text)),
m_reply_text(reply_text),
m_class_id(class_id),
m_method_id(method_id)
{}

The value for 'reply_text' is: "connection exception: CONNECTION_FORCED - Closed via management plugin".
The value for both 'class_id' and 'method_id' is 0.

@ghost ghost assigned alanxz Jun 19, 2012
@alanxz
Copy link
Owner

alanxz commented Jun 19, 2012

Thanks for reporting this. Definitely a bug and I'll look into a fix.

@noldus
Copy link
Author

noldus commented Jun 19, 2012

Thank you. I don't know if it is necessary, but just for clarity: I am running Windows 7 32-bit and building using Visual Studio 2010.

alanxz added a commit that referenced this issue Jun 22, 2012
This is a fix for Issue #12

Reworked the constructors and static Throw() method
to check the results of amqp_method_name before
trying to use it (returns NULL on error)
@alanxz
Copy link
Owner

alanxz commented Jun 22, 2012

Ok should be fixed.

@alanxz alanxz closed this as completed Jun 22, 2012
@noldus
Copy link
Author

noldus commented Jun 25, 2012

Thanks for the quick response and fix. It is very much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants