question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inconsistent Blocking Connection hanging when consumer is idle

See original GitHub issue

Pika: 0.12.0b2 OS: Ubuntu

When the connection is left idle for a long time (e.g. 10 hours). A consumer hangs and does not consume anymore messages. This used to happen on pika 0.10 and it appeared to be solved in v. 0.11 Following example in Pika Examples, the issue could be reproduced.

Moreover:

  • the same problem is difficult to reproduce when pushing to localhost (respect to RabbitMQ in another host/network)
  • no specific output from pika (at debug level)
  • RabbitMQ does not simply to complain about heartebeats
  • When pushing new messages, it appears a “strange log”, that looks like it comes from pika application (that should consume)
rabbit                   | =WARNING REPORT==== 15-May-2018::08:59:41 ===
rabbit                   | closing AMQP connection <0.1090.0> (192.168.1.1:44386 -> 172.18.0.2:5672):
rabbit                   | client unexpectedly closed TCP connection

Apart from big headaches, I would like to point out that in pika 0.11.2 this problem should not be present, but another takes places. When operating very long tasks connection is dropped as well.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:31 (19 by maintainers)

github_iconTop GitHub Comments

1reaction
vitaly-kruglcommented, Jun 8, 2018

@lukebakken, I think the suggestion to use SelectConnection wouldn’t improve the situation, just make his code more complicated due to “callback hell” 😃. Also, the suggestion to use add_timeout to delegate processing to the correct thread looks like a typo. If someone is using SelectConnection directly, and need to schedule a callback inside SelectConnection’s I/O loop safely, they should call the add_callback_threadsafe() method of that SelectConnection’s I/O loop directly - connection.ioloop.add_callback_threadsafe(...) - not add_timeout which isn’t thread-safe.

1reaction
sw360cabcommented, Jun 5, 2018

@lukebakken

I am doing my tests with 0.12.0.b2 and heartbeats at 600s

While testing I am capturing packets (Wireshark). Everything is working smoothly since this morning in the scenario.

I will see if by tomorrow the connection is still available leaving it idle all night long. If this works I would repeat the tests with:

  • pika 0.12.0.b3
  • dockerized version of RabbitMq
Read more comments on GitHub >

github_iconTop Results From Across the Web

Stop channel.basic_consume if the connection is idle/Not ...
I want the consumer to get exited or have a callback method to decide on what i need to do? Like sending a...
Read more >
Source code for pika.adapters.blocking_connection
"""The blocking connection adapter module implements blocking semantics on top of Pika's core AMQP driver. While most of the asynchronous expectations are ...
Read more >
Solving My Weird Kafka Rebalancing Problems & Explaining ...
While Kafka is rebalancing, all involved consumers' processing is blocked (Incremental rebalancing aims to revoke only partitions that need ...
Read more >
Solved: Console producer/consumer not working in kafka 0.1...
Hi,. We have recently started using kafka 0.10.2 but are unable to produce any messages or consumer them. It has kerberos enabled. Below...
Read more >
DIFFERENCES BETWEEN PROCESSES, SESSIONS AND ...
What's the difference between connections, sessions and processes? ... "Oracle decided to keep trickling dirty blocks to disc at a higher rate than...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found