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.

Producer.publish blocks forever on a closed connection when the transport_options of the connection does not specify a retry_policy

See original GitHub issue

Kombu version = 4.4.0

When I call publish on a closed connection, it blocks forever; No exception, No error messages whatsoever. I tried to set a retry policy but The behaviour is the same.

Reproduce

from kombu import Connection

with Connection('pyamqp://localhost:8000') as conn:
    producer = conn.Producer(serializer='json')
    producer.publish(
        'Hello', errback=lambda: print('An error occured!'),
        retry=True, retry_policy={
            'interval_start': 0,
            'interval_step': 1,
            'interval_max': 5,
            'max_retries': 3,
        }
    )

    print('Published!')  # Never gets called

There’s no Rabbitmq server on localhost:8000 So I expect publish to raise a socket.timeout error when it’s unable to connect. Instead, it just hangs forever because it’s trying to establish a connection.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
danidee10commented, Aug 31, 2019

@matteius I just opened a PR and I can confirm that the test fails in 4.4.0, 4.6.3 and 4.6.4 and it works in #1026

PR link: https://github.com/celery/kombu/pull/1093

1reaction
matteiuscommented, Aug 23, 2019

@danidee10 In the original report you are testing this behavior outside of Celery correct? That is really cool and perhaps you wouldn’t mind submitting a PR with a unit test that shows this failure – we need more unit test coverage here regardless so if you can cover that regression with a failing test in your version of kombu 4.4.0 while in parallel test if the latest 4.6.3 and 4.6.4 (I am less likely to recommend 4.6.4, esp for folks using redis due to a different bug report, but try both) and also making a PR with such a unit test into celery/kombu will kick of the Travis Ci and Appveyor CI checks against master and so we can really pinpoint that it stays fixed and isn’t reintroduced as a regression later on.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Kombu Documentation - Read the Docs
In a publish/subscribe scenario producers publish messages to topics, ... Created upon access and closed when the connection is closed.
Read more >
Change history — Kombu 5.2.4 documentation - Celery
Prevent event loop polling on closed redis transports (and causing leak). Respect connection timeout (#1458). prevent redis event loop stopping on 'consumer: ...
Read more >
How to reconnect kafka producer once closed? - Stack Overflow
Generally, calling close() on the KafkaProducer is sufficient to make sure all inflight records have completed: /** * Close this producer.
Read more >
Failover Transport Reference - Apache ActiveMQ
The configuration syntax allows you to specify any number of composite URIs. ... If it does not succeed, or if it subsequently fails,...
Read more >
Spring XD Guide
hadoopDistro - The Hadoop distribution to be used for HDFS access. HDFS is not available if not set. • help - Displays help...
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