-
-
Notifications
You must be signed in to change notification settings - Fork 276
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
Version v5.0.5 might have introduced a breaking change in while_executing and was not documented #230
Comments
This may also be causing some issues that we are seeing. We have a system with very high throughput.
Can't reproduce this behaviour in a dev or staging environment because can't replicate the amount of traffic that production gets. I suspect it has something to do with the Mutex lock change in this commit |
We also observed a similar issue. After upgrading from 4.0.17 to 5.0.8, our system proceeded with processing only one job at a time, regardless of job class or arguments. We are also using the |
@jianghong Looks like pulling the mutex to a constant might have broken it? It will have the same value across instances, therefore if it's locked in one, it'll be locked in others. Previous approach was a per instance mutex which makes more sense. |
Yeah, I think it's a good bet that's the culprit, but I'd like to hear @mhenrixon's thoughts |
I don't know if I'm having the exact same problem, but it sounds similar enough, so I figure I'll drop my two cents: I'm running We had a client's server go down, so some of our jobs connecting to them were failing. For some jobs, the job's We ran some code that searches for duplicates based on Like others have said, I can't seem to reproduce this on my own because I can't figure out how to simulate similar load, but there's definitely some scenario under which this gem's duplicate checking seems to break. |
I'll obviously have to rethink the mutex. The problem with the instance mutex was on the other side of the spectrum. I'll get back to you on this |
It is extremely hard to test is my biggest problem with it but I was working on that. |
Easy way of replicating the issue:
from the console:
Output in logs:
|
@mhenrixon Out of curiosity, what would be the downside of running the older version using an instance mutex? AFAIK we ran it in production without any issues. |
@skalb, @shlajin, @jianghong, @glennfu, @michaeldever, @gtc18728, @kchasel, if you wanted to help test the branch |
Hi,
After updating the gem on my server I noticed that the jobs are run differently. It seems that the v5.0.5 and the mutex change from instance to class changed the behaviour and sadly it was not documented.
Previously, when using
while_executing
I was able to limit unique jobs for the same class with passing different unique_args - meaning some jobs actually might have been run in parallel but with different unique arguments.For example, a certain User could not run multiple Work jobs, but multiple different Users could run their Work job in parallel. For example (jobs in Sidekiq, enqueued simultaneously):
So in previous version of the gem, jobs 1 and 3 would run in parallel (since unique_args values were not unique), and job 2 would wait for job 1 to end.
After the change (and only I'm assuming that) all Work classes are using the same mutex, therefore only one Work class can be run at a time, meaning that in the above example job 3 would wait for job 1 and/or 2 to finish before actually running.
Is there a way to get the previous approach other than using the version before v5.0.5?
The text was updated successfully, but these errors were encountered: