Pika Blocking Connection timeout at 180 sec max

1,231 views
Skip to first unread message

Amulya Sharma

unread,
Jun 20, 2017, 11:39:42 AM6/20/17
to Pika
https://github.com/pika/pika/issues/824#issuecomment-309452627

we are using Pika blocking connection adapter, we do not have idle timeout set in our stack, but still its timing out at 180 sec max, here is the sample code, we tried to introduce heartbeat but that is not helping at all ... this is very critical and any help is greatly appreciated

params = pika.URLParameters(url)
params.socket_timeout = 300
params.heartbeat_interval = 20
params.blocked_connection_timeout = 300
connection = pika.BlockingConnection(params)
channel = connection.channel()
channel.queue_declare(queue='hello')
channel.basic_publish(exchange='', routing_key='hello', body='Hello')
print "Sent 'Hello World!'"
print "sleeping "
time.sleep(280)

def callback(ch, method, properties, body):
print " Received %r" % (body)
channel.start_consuming()
channel.basic_consume(callback,
queue='hello',
no_ack=True)
connection.close()

vitaly numenta

unread,
Jun 27, 2017, 6:16:45 PM6/27/17
to Pika
There is more activity on the rabbitmq-users google group, including for pika, so your chances of getting pertinent help there are better. One of the first questions you will be asked is to describe your network topology, provide AMQP logs and pika debug-level logs demonstrating the issue.

Gavin M. Roy

unread,
Jun 27, 2017, 7:56:13 PM6/27/17
to pika-...@googlegroups.com
You're blocking pika from being able to communicate for 280 seconds and being disconnected.  Don't do that and you should be fine.  See BlockingChannel.sleep

--
You received this message because you are subscribed to the Google Groups "Pika" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pika-python+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

vitaly numenta

unread,
Jun 27, 2017, 8:35:54 PM6/27/17
to Pika
Good point, thx Gavin
Reply all
Reply to author
Forward
0 new messages