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.

Set a reasonable default value for max_retries to avoid infinite loops

See original GitHub issue

Hi,

Thank you very much for the fantastic work you do with Celery.

I’m using Celery 4.4.7, and I just spent a lot of time understanding why my server froze when calling my_task.delay(). It turned out that I had a name resolution error, and Celery (or more exactly Kombu) was retying forever to connect to the broker. I first tried to fix the infinite loop with broker_connection_max_retries but later realized that broker_transport_options was the culprit because the default for max_retries is None. BTW, the Celery documentation should be more clear about the difference between broker_connection_max_retries and broker_transport_options['max_retries'].

Retrying forever is a bad idea because it prevents the exception from bubbling up and makes errors very hard to diagnose. Please set a reasonable default value for max_retries to avoid this situation. From my experience, each connection retry takes several seconds, so a small value (let’s say 10) is already a very long wait.

Best regards, Benoit

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bblanchoncommented, Feb 28, 2021

As I implied in my original message, I think 10 is a reasonable default, but it could be lower. For example, I use the value 3 in my project, which means a total of 4 connection attempts.

1reaction
thedrowcommented, Feb 28, 2021

I think what Asif means is: What do you consider a reasonable default?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can I set max_retries for requests.request? - Stack Overflow
Looking at the source code I didn't find any place where I could alter the default (presumably 0) value. So is it possible...
Read more >
Retry behavior - AWS SDKs and Tools
Specifies the maximum number attempts to make on a request. Default value: If this value is not specified, its default depends on the...
Read more >
Avoid infinite loops with flow trigger conditions in Power ...
Preventing infinite loop /race condition - Same item is modified within the flow. 2. Trigger flow when a column value is updated.
Read more >
Configuration - Spark 3.3.1 Documentation - Apache Spark
Most of the properties that control internal settings have reasonable default values. Some of the most common options to set are: ...
Read more >
Utilities - urllib3 1.26.13 documentation
Each retry attempt will create a new Retry object with updated values, ... this to 0 to account for unexpected edge cases and...
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