-
Notifications
You must be signed in to change notification settings - Fork 104
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
isConnected reports true while it is not #78
Comments
Hello, As PHP is single-threaded, processing of messages cannot take you more than heartbeat timeout, otherwise client doesn't get a chance to send something to the broker and the broker forcefully closes the connection. If you connect to the broker over local network, it's ok to use large heartbeat timeouts. One production consumer I created needed to work for more than 10 minutes, so the heartbeat was set to 15 minutes without a problem. When you call sync client's |
I have the same issue. Regardless of the heartbeat timeout, a connection could have been closed from the rabbitMQ server side and we need to know when to re-connect. The only time I can detect the connection was closed is after the write to the channel fails because isConnected always returns true, and the client state is always 2. I have also seen the channel I see I'm at a loss for how to make this library check for a reliable connection. |
@xorock take a look at the tests here: https://github.com/jakubkulhan/bunny/blob/master/test/Bunny/ClientTest.php I dug in deep, as this wasn't documented. I used the Hope that helps. |
Hi, I have the same issue and I found out, that the Broken pipe exception is thrown in the destructor. I don't know why, but the clean shutdown is only implemented in
Now the client is really disconnect but I don't think it was meant to be so complicated. Shouldn't there be a clean shutdown? I think the destructor should only call The broken pipe exception is really bad in that case, because it's triggered by the garbage collector and could not be catched. And the fix should be easy to implement. |
If it is not a bug then maybe You can show me right path how to handle this. I have a long-lived consumer that parses incoming messages (text documents) and then publisher sends a reply to another queue. Now, if heartbeat is set to 10s, producer connection is killed after that time but isConnected() method always reports true.
After that time I get Broken pipe or closed connection exception.
As a workaround, I set heartbeat option to 5 minutes, then changed $channel->run to $bunny->run(5 * 60) and the supervisord daemon starts the process again.
The text was updated successfully, but these errors were encountered: