perry2of5 commented on code in PR #48557:
URL: https://github.com/apache/airflow/pull/48557#discussion_r2164711654


##########
airflow-core/src/airflow/models/taskinstance.py:
##########
@@ -1114,12 +1114,15 @@ def next_retry_datetime(self):
 
         delay = self.task.retry_delay
         if self.task.retry_exponential_backoff:
-            # If the min_backoff calculation is below 1, it will be converted 
to 0 via int. Thus,
-            # we must round up prior to converting to an int, otherwise a 
divide by zero error
-            # will occur in the modded_hash calculation.
-            # this probably gives unexpected results if a task instance has 
previously been cleared,
-            # because try_number can increase without bound
-            min_backoff = math.ceil(delay.total_seconds() * (2 ** 
(self.try_number - 1)))
+            try:
+                # If the min_backoff calculation is below 1, it will be 
converted to 0 via int. Thus,
+                # we must round up prior to converting to an int, otherwise a 
divide by zero error
+                # will occur in the modded_hash calculation.
+                # this probably gives unexpected results if a task instance 
has previously been cleared,
+                # because try_number can increase without bound
+                min_backoff = math.ceil(delay.total_seconds() * (2 ** 
(self.try_number - 1)))
+            except OverflowError:
+                min_backoff = MAX_RETRY_DELAY

Review Comment:
   Lower in the function the code ensures the delay isn’t longer than a day, 
but it doesn’t log anything when it does so. I'm talking about this:
   
   `min(modded_hash, MAX_RETRY_DELAY)` around line 1149
   
   We don't inform the user we are putting a cap on the exponential time, so it 
seems inconsistent to log about capping the value due to overflow but not due 
to exceeding the MAX_RETRY_DELAY. Overflow is just a implementation detail due 
number representation limits.... I think capping the value due to overflow and 
due to exceeded the MAX_RETRY_DELAY could both be unexpected.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to