-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Task timeouts don't work. Also, what is the expected behavior of a timed out task? #106
Comments
This question is very important. It seems the queue worker just resets the task to its start_state on timeout, the result is an infinite loop where the same tasks keeps timing out and getting picked up again. I think ideally, a timed out task should be put in its error_state and only be picked up if there are unused retries. |
There are four aspects to the issue. The result is that newcomers can very easily be mislead.
@drtriumph: Would a PR fixing those points be accepted? |
@eyeezzi @Caerbannog Totally agree with your suggestions. Resetting a timed-out task to its error state instead of its start state seems much more intuitive to me. The only problem I see is that such a change of behavior in the API would certainly mean a reasonable impact. To minimize it, I'd suggest to add a new optional field to the spec defining the task's state when it times out. Something like "default_spec": {
"start_state": null,
"in_progress_state": "in_progress",
"finished_state": null,
"error_state": "error",
"timeout": 300000,
"timeout_state": "error",
"retries": 3
} If this Let me know what you think. |
I am also experiencing enldess loop of tasks when they exceed default timeout of 5min. I do not want to change the timeout, 5 minutes is fine. Also, the tasks continue running in the background, which is fine. I just send an alert to manually check those tasks. What I did to stop the faulty behaviour ATM :
I am still experiencing tasks restarting by themselves, so I might be doing it wrong. If you guys have a better idea :) |
I've tested queue timeouts and noticed the following:
Queue timeouts as specified by the default spec are not respected by the firebase queue. This can be replicated by setting a timeout value in the default spec and adding a handler that uses setTimeout() with a value greater than the timeout value. The task is owned and completed by the setTimeout handler even after it should have timed out.
The expected behavior of timeouts if they were working isn't documented anywhere. If the task times out, is it supposed to be put into an error state or does it return to the start_state?
The text was updated successfully, but these errors were encountered: