[rabbitmq-discuss] Behind NAT issue with pika client :: keep alive :: heartbeat - How to detect dead connection

alkos cybersayo at gmail.com
Tue May 15 08:49:25 BST 2012


I'm having pika client that act as consumer/producer in same time, rpc
scenario. As a consumer it waits for command from rabbitmq and when it
rcv's client execute function and returns result to rabbgitmq.
In lab conditions (permanent IP address without any firewall in
between client and rabbitmq server) there was no problem, at least not
in 3-4 days.
When we put client behind NAT, consumer stop rcv after few hours.
Problem, ofcourse was change end-to-end path of tcp connection. DHCP
would give different IP address to WAN interface of ADSL, or even to
PC with pika client. Previously established connection is still there
with ESTABLISHED status (netstat -t shows it) - even of rabbitmq
server I can still see that socket connection with ESTABLISHED

I've tryed to put in rabbitmq.config keep alive option but with now
success at all.

Since I'm using RPC scenario, I'm using BlockingConnection.
Also, I've tryed to put heartbeat=True, but then script keep closing
and opens connection - probably due to callback function.
Even with threading class that implement function that is called in
callback I have the same issue.

I can hardly beleive that I'm the only one person who have this kind
of problem, since I didnt find any simple solution to this problem.

So, basicly my question is how to detect from within script that there
is no end-to-end connection to rabbitmq even though socket exists?



More information about the rabbitmq-discuss mailing list