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

Race condition in shutdown #4115

Closed
mperham opened this issue Mar 1, 2019 · 2 comments
Closed

Race condition in shutdown #4115

mperham opened this issue Mar 1, 2019 · 2 comments

Comments

@mperham
Copy link
Collaborator

mperham commented Mar 1, 2019

If a job continues processing until the shutdown timeout (-t), there is a race condition between requeueing the job and the job terminating. Specifically if it raises an error, it can create a retry after the job has been requeued, leading to job duplication.

See #4112 for a real world case.

@mperham
Copy link
Collaborator Author

mperham commented Mar 1, 2019

Notes:

  • Sidekiq does document that jobs can be run twice, this is one such case.
  • There's no easy way to remove the race condition completely. Two threads can be performing two Redis operations at the same time and I don't want to dramatically increase the complexity of our Redis communications, which itself can introduce new bugs or race conditions. Lua would be necessary to make these high-level operations (e.g. bulk requeue, create retry) mutually exclusive.

@mperham
Copy link
Collaborator Author

mperham commented Apr 12, 2019

I think this might be fixed by #4141 and 5.2.6.

@mperham mperham closed this as completed Apr 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant