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

Feature/ add jobs tab with status 'stuck' #276

Open
fogine opened this issue May 17, 2021 · 11 comments
Open

Feature/ add jobs tab with status 'stuck' #276

fogine opened this issue May 17, 2021 · 11 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@fogine
Copy link

fogine commented May 17, 2021

There is missing tab in queue page with jobs that are in stuck status.. It should be possible to clean/restart those..

@fogine fogine changed the title Feature/ add jobs tab with statuc 'stuck' Feature/ add jobs tab with status 'stuck' May 17, 2021
@felixmosh
Copy link
Owner

Sounds like reasonable

PR is always welcome

@felixmosh felixmosh added enhancement New feature or request good first issue Good for newcomers labels May 17, 2021
@revathskumar
Copy link

@fogine @felixmosh Is this ticket still relevant?

Couldn't find any reference to stuck as a state.
https://github.com/taskforcesh/bullmq/blob/cf0710cfe322eb2147f439364b425763b4d5c592/docs/gitbook/api/bullmq.jobstate.md

Correct me if I am wrong.
Please give me some direction on

  • how to identify the jobs with are stuck status
  • how to we can move a job to stuck state for testing purpose.

@felixmosh
Copy link
Owner

There is no stuck status of a job in bullmq.

There is a term called stalled which refers to a job that it's queue didn't got any updates regarding it.

I guess that @fogine talked about it.
From the bullmq docs, it is handled automatically.

So, if you have something to elaborate, please do :]

@fogine
Copy link
Author

fogine commented Feb 22, 2022

@revathskumar & @felixmosh I refer to this job.getState() === 'stuck'..
According the following documentation and source code, the job can get into stuck state even though its not documented much and I'm not sure what's the cause. I'm not referring to stalled jobs, even though it would be also nice to be able to remove them by hand (even though they are handled automatically most of the time)..

https://github.com/OptimalBits/bull/blob/90f040c052325da302c99f17111a12d1afbe88bd/REFERENCE.md#jobgetstate
https://github.com/OptimalBits/bull/blob/30d59590c34cb664e3b9a62695c4092c9b1ae3f3/lib/job.js#L425

@fogine
Copy link
Author

fogine commented Feb 22, 2022

The following test case implies that job can get into a stuck state when its not found in any other state
https://github.com/OptimalBits/bull/blob/b50512e1a823f01393bc4a72d2b028c032f8a678/test/test_job.js#L267

@fogine
Copy link
Author

fogine commented Feb 22, 2022

If thats the case, it is quite important to know about such jobs and be able to clean them.. I experienced an issue where I could not create a job with specific jobId as another job already existed in the stuck state with that jobId

@felixmosh
Copy link
Owner

@fogine thank u for the info.

From the test case that you've posted, looks like a job become stuck when

await job.releaseLock();
await job.remove();

Do u really have a "proper" use case that makes your job to become in stuck state?

@fogine
Copy link
Author

fogine commented Feb 22, 2022

I'm sure that job.releaseLock does not get called anywhere in the related project.
In my opinion, if job can get into such state, it would be useful to see those jobs in the admin ui.

EDIT
I think that the test case calls explicitly releaseLock to unset job status. In practice I think stuck jobs may happen due to network error or when nodejs process get interrupted.. just guessing..

@felixmosh
Copy link
Owner

I've tried to add the stuck status, but it is not supported by bullmq & bull types, https://github.com/taskforcesh/bullmq/blob/master/src/types/job-type.ts#L10

I don't think that it is smart to add internal statuses.

@fogine
Copy link
Author

fogine commented Feb 22, 2022

Hm, I think it might be related only to the bulljs project, not bullmq. As bulljs was completely rewritten to bullmq it seems that stuck jobs does not exist there - at least I can not find it in the source code and the test case for isStuck is commented out in bullmq project..

@felixmosh
Copy link
Owner

Same issue applies to bull, source code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants