Skip to content
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

Prevent jobs from stalling over-and-over #106

Open
bradvogel opened this issue Mar 27, 2018 · 4 comments
Open

Prevent jobs from stalling over-and-over #106

bradvogel opened this issue Mar 27, 2018 · 4 comments

Comments

@bradvogel
Copy link
Contributor

We ran into a situation where a single job kept stalling over-and-over because the work it happened to be doing was crashing the instance.

Although it's not the queue's fault, in thinking about this, it's probably quite common that jobs stall because of the work that particular job instance is doing (instead of outside factors such as random server restarts). If that work crashes the instance 100% of the time, it'll get stuck in a "stall loop".

I propose adding stallLimit as a parameter. If a job stalls more than this many times, it'll be moved to failed with the failure reason Job stalled more than stallLimit.

What do you think?

@bradvogel
Copy link
Contributor Author

cc @skeggse

@LewisJEllis
Copy link
Member

Yea, definitely want to do something along these lines; I've run into similar issues in certain situations.

Should stallLimit be a property of the queue, or of the job? I suppose we could have it be a property of both, where a job inherits its queue's stallLimit by default but that can be overridden.

@bradvogel
Copy link
Contributor Author

I'm thinking the job since it's somewhat analogous to retries. However it makes the implementation a bit more complex since we have to store the stallLimit with each job alongside stallCount.

@LewisJEllis LewisJEllis added this to the 2.0.0 milestone Mar 27, 2018
@LewisJEllis
Copy link
Member

Observation/thought I had tonight - if we make the stallLimit a property of the queue, and we let absence of stallCount implicitly mean 0, then we can actually implement this without any extra data on typical jobs from what we have now. We would only need to add a stallCount property to jobs that have stalled and been retried at least once. Will complicate the checkStalledJobs Lua script, but probably worthwhile for the average case upside.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants