Cloud Tasks retries task even though max attempts = 1 in queue configuration

My queue is running unexpected retries on tasks where attemptDispatch results in an error as seen in attemptResponse. Normally the queue doesn't execute retries, which is desired behaviour. For this single task it does; the only difference I notice is that the reason of the failed attempt is an out of memory issue instead of a controlled error response:

Screenshot 2023-10-23 at 15.14.50.png

 My queue is configured with max attempts = 1, see:

Screenshot 2023-10-23 at 15.10.09.png

The attemptDispatchLog that Google Cloud Tasks writes shows me the following: 

Screenshot 2023-10-23 at 15.10.49.png

 This is unexpected as the maxAttempts should most logically be set to 1.

Retries are executed (also unexpected)

Screenshot 2023-10-23 at 15.17.33.png

Screenshot 2023-10-23 at 15.18.46.png

 This is causing duplicate runs that are not expected, which is causing trouble in our system. We are moving towards idempotent jobs as suggested by the Cloud Tasks documentation. But still we would like to know what is going on in this scenario.

3 3 714
3 REPLIES 3

I have the same issue, my task retried 6 times while setting the limit to 3, I am not sure if it would have continued because it stopped failing since I was releasing a fix.
This is concerning, I need this to be reliable

Hi, I was experiencing the same issue. I got around the problem by setting max attempts to 1 and max retry duration to 1 second and then min and max backoff to anything greater than 1 second. 

From https://cloud.google.com/tasks/docs/configuring-queues#retry:

"Cloud Tasks stops retrying only when MAX_RETRY_DURATION and MAX_ATTEMPTS are both satisfied. Once MAX_RETRY_DURATION time has passed and the task has been attempted MAX_ATTEMPTS times, no further attempts will be made and the task will be deleted.  "

You can set the Max Retry Duration to zero if you only want Max Attempts to be respected.

 

Top Labels in this Space