jakubkulhan/bunny

client unexpectedly closed TCP connection

sm2017 opened this issue · 10 comments

In rabbitmq logs I see too many client unexpectedly closed TCP connection

Hi! This happened to me when there was a load balancer between the clients and the broker with idle timeout lower than heartbeat.

Even if there is no LB, I guess this happens because of setting heartbeat timeout too low. Default is 60 seconds. If you do in consumers any work longer than that, the PHP cannot send heartbeat packet to the broker, therefore the connection gets closed.

@jakubkulhan there is no load balancer and my heartbeat timeout is 60 seconds
I have no works longer that 5 seconds

Do you use sync, or async client? For sync client you have to call Client::run(). Async client need to be passed React event loop and then event loop's run() method has to be called.

I use async client and do as you told
My code is running for months , it is a long running php
After days I see in my application rabbit m client is not working well , I see client unexpectedly closed TCP connection in rabbitmq log

I don't see a reason why this happens. If it happens only after days of the consumer running, try checking if there are no memory leaks (cycles) that could cause long GC pauses.

@jakubkulhan I see in rabbitmq logs that 0.5 second after connection is established . connection closed with client unexpectedly closed TCP connection error

@jakubkulhan Do you know why the connection is closed after less that a seconds?
And rabbit mq server detect it is client unexpectedly closed TCP connection ?

Duplicated in #59

@sm2017 did you manage to solve the problem with client unexpectedly closed TCP connection?

@iskripka it's for years ago, I don't remember