#Will MAX_DURATION_EXCEEDED errors retry?

1 messages · Page 1 of 1 (latest)

shrewd igloo
#

I have tasks that fail with MAX_DURATION_EXCEEDED but they don't seem to be retried even with a maxRetries count set. Is this expected?

dim geodeBOT
#

Hi @shrewd igloo. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Based on the available knowledge sources, when a task run exceeds the maxDuration, it is stopped and marked as "Timed out" with a MAX_DURATION_EXCEEDED error. The documentation does not explicitly state whether such errors will trigger a retry, but it does mention that when a task run exceeds maxDuration, the lifecycle functions cleanup, onSuccess, and onFailure will not be called Max duration and lifecycle functions.

Additionally, the general retry mechanism in Trigger.dev is triggered when an uncaught error is thrown inside your task, and the task will be retried according to its retry settings Errors & Retrying. However, there is no explicit mention in the documentation that MAX_DURATION_EXCEEDED errors are treated as retryable errors.

Given your observation that tasks failing with MAX_DURATION_EXCEEDED are not retried even with a maxRetries count set, and the lack of documentation stating otherwise, it appears this is expected behavior. The knowledge sources do not provide enough information to confirm if this is by design, but there is no evidence that exceeding maxDuration will trigger retries.

If you need further clarification, it may be best to reach out to the Trigger.dev team or consult their support channels.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@shrewd igloo Kapa.ai is still learning and improving, please let me know how I did by reacting below.

earnest flume
#

Yeah the max duration is across all retries, designed to prevent a bug in your code causing runaway compute. It will completely fail the run (in the current version).

#

We could do a thing where we make it configurable to only timeout the current attempt

#

Would that be useful?

shrewd igloo
#

Hmm, I'm not sure. It might be better, generally, for me to just be forced to increase max duration. I'm not sure. The use case is related to AI things that are not deterministic and so I have them complete in a few minutes sometimes, and sometimes in 30m.

earnest flume
#

Yeah I think that's a pretty common use case

#

I'd love to figure out good solutions for this.

The way to solve this yourself might be to create an AbortSignal with a timeout and pass it in to the calls, and subscribe to it. You can then throw an error to retry the task yourself if it's slow

#

You'd still keep maxDuration to prevent something going forever across attempts.

shrewd igloo
#

OK great idea, I'll look into this

shrewd igloo
#

@earnest flume it looks like TASK_RUN_STALLED_EXECUTING also is excepted from automatic retries

earnest flume
#

Are you on v3?

shrewd igloo
#

v4