Producer.publish blocks forever on a closed connection when the transport_options of the connection does not specify a retry_policy
See original GitHub issueKombu 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:
- Created 5 years ago
- Reactions:1
- Comments:9 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@matteius I just opened a PR and I can confirm that the test fails in
4.4.0
,4.6.3
and4.6.4
and it works in #1026PR link: https://github.com/celery/kombu/pull/1093
@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.