tobi / delayed_job

Database backed asynchronous priority queue -- Extracted from Shopify
http://tobi.github.com/delayed_job
MIT License
2.15k stars 1.25k forks source link

* [JOB] failed to acquire exclusive lock for xxxx #18

Closed matthutchinson closed 14 years ago

matthutchinson commented 14 years ago

Hi,

Maybe Im not doing something right, or there is another way to do this, but I get this LockError raised a lot when Im trying the following;

I have an after_destroy, that does a Delayed::Job.enqueue() This works fine in the single case, but I also have a dependent destroy arrangment setup - so this hook will be called multiple times in succession.

I expected that to create multiple jobs in the table, each of which get processed one by one until the queue is empty.

Unfortunately only some get processed and other raise this LockError..

Can anyone help me out? ...

m

matthutchinson commented 14 years ago

BTW, the job workers are kicked off by the master, that I started with script/delayed_job start

matthutchinson commented 14 years ago

I should also point out that on raising this LockError, the job is not ran, and the delayed_jobs table is empty at the end of the process

matthutchinson commented 14 years ago

Good lordy - I'm a fool :S

Realised now that I have multiple delayed_job processes running on the same machine (which I shouldnt)

Well - let this post be a lesson to anyone who find themselves in the same boat!

tobi commented 14 years ago

I have trouble following this ticket. If it's still a valid problem please reopen it and post some steps to reproduce.

matthutchinson commented 14 years ago

No a valid problem, please close it

leela0804 commented 13 years ago

Thx! had the same and resolved it

omsoft commented 11 years ago

I had the same issue: there was a pending dispatch that cannot be locked by any further instance of delayed job. Deleted it from the database, restarted all delayed jobs and everything come back to play properly. I don't know why... but it worked out!