socket.timeout on heartbeat (or any other write)
See original GitHub issueHi,
I used kombu with the py-amqp transport and I have the following issue:
I have consumer code that looks like:
while True:
try:
conn.heartbeat_check()
try:
conn.drain_event(timeout=mytimeout)
except socket.timeout:
pass
do_special_stuff()
except conn.recoverable_channels_errors + conn.recoverable_connection_errors:
do_repair_connection()
So I expect that ‘do_special_stuff’ is called every 'mytimeout ’ or the connection have been closed. But sometimes the heartbeat_check() will write a packet to the socket to send the heartbeat frame and if something bad occurs at this moment on the tcp connection, the application can stuck until the system tcp timeout is reached and then heartbeat_check() raise socket.timeout.
So I would like to control the timeout of the writing of heartbeat frame (and more globally any other frame we write on the socket when we declare or publish something)
After some digging into the kombu/py-amqp code, I haven’t found a way to set the socket timeout of the connection used to write that (or any other) frame to the socket.
Does my needs make sense to allow a default socket timeout per connection or something like that ? and that just need to be implemented, or I have missed something ?
(Note: I would like to avoid to change the default python socket timeout or set a different system tcp timeout)
Cheers,
Issue Analytics
- State:
- Created 8 years ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
Was this issue successfully resolved? I think I am getting a similar issue running kombu 4.1.0 where kombu is disconnecting on a publish command with the following error:-
This is failing to reconnect even after attempting to reconnect 10 times:-
Also worth noting is that I get the following warning when kombu attempts to reconnect:-
I assume this warning will disappear when we move to kombu 4.2 later today but is there any word on the publish disconnect error?
closing as fixed