enqueue-dev icon indicating copy to clipboard operation
enqueue-dev copied to clipboard

How to clear/handle stuck jobs when using the enqueue/job-queue?

Open aun408 opened this issue 7 years ago • 13 comments

Hi, I have one issue where the child job status is enqueue.job_queue.status.success but it's root job still in enqueue.job_queue.status.running status. So leaving the records (root and child) in enqueue_job_unique table and causing the subsequent jobs (same name) not able to run. I can clear it from database manually, just wondering if there is any better way to do so?

aun408 avatar May 24 '19 09:05 aun408

I think this is a bug.

makasim avatar May 24 '19 10:05 makasim

I see, I see try to get the reproduction steps for this if possible. Need to do some debugging to get the details.

aun408 avatar May 24 '19 23:05 aun408

I'm going to put this here because although it doesn't exactly match the ops issue. It does match the title, and is very much along the same lines.

If the queue consumer crashes, jobs get left in enqueue.job_queue.status.running. This situation also leaves subsequent jobs unable to run, just as in the ops situation.

Is there a way to gracefully handle this barring manually deleting them?

leigh-ols avatar Jun 12 '19 10:06 leigh-ols

@leigh-ols what queue transport do you use? What you've said should not be the case for RabbitMQ

makasim avatar Jun 12 '19 10:06 makasim

In local development at the moment, and so only using FS queue transport. Could this be an issue pertaining specifically to enqueue/fs?

leigh-ols avatar Jun 13 '19 08:06 leigh-ols

yes, it is the issue. FS transport does not keep track of lost messages. If there is an exception or the process is killed the message is lost.

makasim avatar Jun 13 '19 09:06 makasim

That's fine, it's only for testing/dev purposes anyway. I was more concerned about issue persisting into production. We'll be using a different transport in production, so my concerns have been allayed.

leigh-ols avatar Jun 14 '19 07:06 leigh-ols

I have the same problem as @aun408 when I run many consumers. It works fine if I run only one.

there is a pull request in #786 that could fix the bug.

https://github.com/php-enqueue/job-queue/pull/3

Kevlys avatar Jun 14 '19 13:06 Kevlys

another workaround is to use the --message-limit option to 1.

`php bin/console enqueue:consume --message-limit=1``

works for me using supervisord.

Kevlys avatar Jun 17 '19 09:06 Kevlys

@Kevlys please create PRs to this repository, instead of sub-repositories that are read-only. Thanks ;)

Steveb-p avatar Jun 20 '19 10:06 Steveb-p

@Steveb-p I did'nt create any PRs anywhere. I just referenced it.

Kevlys avatar Jun 20 '19 16:06 Kevlys

@Kevlys sorry, I didn't look and assumed it was yours. Apologies :bowing_man:

Steveb-p avatar Jun 22 '19 15:06 Steveb-p

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 22 '19 17:07 stale[bot]