-
-
Notifications
You must be signed in to change notification settings - Fork 277
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Please try v7.0.10 #571
Comments
Do |
Hi @bekicot, not a requirement, definitely recommended if you are on regular ruby and are able to use C extensions as it does speed up things a little. I use it for every project that deals with redis and sidekiq |
Hello, first of all thanks for this great gem. However I see some problems after the upgrade from v6... In particular if I run rspec in our application I get hundreds of messages like this:
This is one of the workers that produce the error:
Then in the tests:
What does it mean? What should I do? |
Hi @collimarco, Please see the section about testing: https://github.com/mhenrixon/sidekiq-unique-jobs/#testing I recommend you leave the testing of uniqueness to the gem maintainer. There are ways to test uniqueness but it is complex and unreliable. |
@mhenrixon Thanks for the reply! The test for uniqueness here is just an example... I can even remove that test from our test suite, however I would not solve the problem. We have tens (or hundreds) of WARN like that above in very different tests : I took one that was simple to reproduce for you. Basically every test that involves background workers in some way raises that errors. I'm not talking about testing uniqueness, I am talking about tests that deal in some way with background workers. All our tests have been passing for years using SidekiqUniqueJobs v6... While today, if I update to v7, everything raises that WARN (which is totally obscure to me). What does it mean? Any idea on how to fix it? |
Example: # this is a perfectly valid test, but with v7 the test raises warnings
it 'tests something' do
ExampleUniqueJob.perform_async
# ...
ExampleUniqueJob.perform_async
# ...
end |
Update after using below config since last night: config.reaper_count = 1000
config.reaper_interval = 600
config.reaper_timeout = 595
I also see the reaper removes some orphans so that's good.
I don't see the impact on Redis memory so running reaper every 10 minutes is good enough in my case. I would consider the problem solved just by using reaper every 10 minutes and using I'd recommend other users who use Redis intensively (~3k ops/s) to be aware of how slow reaper can be and adjust their config to avoid leaking threads when the reaper can't complete work within Thanks @mhenrixon for help with investigating the issue. |
No, thank you @ArturT you did most of the investigation. I am so happy you managed to find a workaround until I get the underlying issue completely fixed. I will also see about improving the performance here a bit. What I had in mind was to use futures and zip them at the end so at least the checks don't have to run in parallel. Even if it wasn't perfect, as long as no one is negatively affected I am super pleased with the release overall. Having someone like you test it will help me get v7 in top shape. Thank you for taking a leap of faith and trusting. Ultimately, after fixing the issues you found with the reaper, I still have to make sure that reaping is not needed anymore but I wanted to buy myself some time to really dig into the details.
When that is done, I'll see about adding some more features:
|
👋🏻 It seems like the Locks and Changelog web pages have some functionality problems.
|
I can confirm this issue. When you click the
Have you tried |
Thank for the report @DAmatheson and @ArturT I will see about getting that fixed this weekend. |
Merp! Been a crazy week, kids sick and such. Hopefully finding a minute during this weekend. |
@DAmatheson @ArturT I have something almost ready now: #584 |
@DAmatheson @ArturT it has been released as |
hi @mhenrixon ! sidekiq_options(
lock: :until_and_while_executing,
on_conflict: {client: :log, server: :reschedule},
lock_ttl: nil,
lock_timeout: 0
)
def perform(a)
end and then I've put 10_000 jobs in a queue 10_000.times { |i| TestJob.perform_async i } after starting Sidekiq I got a lot of messages like
by monitoring jobs execution in sidekiq web, I noticed, that some jobs were executed, whereas another were rescheduled, so that total count of processed jobs was ~15_000 (each second job was rescheduled?) do I miss something in configuration? thanks |
@roman-melnyk this would be expected. Waiting for zero seconds means that when the job is not able to achieve a lock it will timeout after the number of seconds you configured it for. #598 commented on the logs being kind of verbose and wanted to have the ability to silence them. What I'd like to do is to add hooks or lifecycle events to the gem so that people can do what they want with this type of information. That way, I don't have to log the warnings but can leave it to the user to act if they feel it is worth acting on. In this case, it should probably not be a warning because in all actuality the gem is doing what it is supposed to. Does that help at all? Any suggestions for how to make it more clear? Perhaps reducing the log level or merging the related PR to allow silencing the information until I have time to add the hooks? |
@mhenrixon thanks for reply! def primed_async(conn)
return yield if Concurrent::Promises
.future(conn) { |red_con| pop_queued(red_con) }
.value(drift(config.pttl) / 1000) # Important to reduce time spent waiting
warn_about_timeout
end it's 0.002 s |
just noticed - in this case I'm getting a lot of |
so, what is seems worked for me - keep return yield if Concurrent::Promises
.future(conn) { |red_con| pop_queued(red_con) }
.value(0.05) # testing value then I get no unlock warnings, no timeouts |
Thanks for the details @roman-melnyk I'll take another stab at this again. Just a little too late for me right now. |
@roman-melnyk I believe |
Hi! Thanks for all the work you've put into v7. I'm very excited about the reaper feature, which should let me get rid of some custom code for handling orphan locks. I'm trying out the version 7 upgrade. One thing I was a little confused about is Also, in my test suite, I have several cases where version 7 now throws a warning like this:
For version 6, I was removing the uniquejobs client middleware from the Sidekiq chain in the spec helper. I tried removing that block, and I also tried mirroring all the initializer changes, like this:
In all cases, I still get that timeout warning. If I set a higher-than-zero value for |
@ragesoss there is a section in the readme about testing. SidekiqUniqueJobs.configure do |config|
config.enable = !Rails.env.test?
end For example. |
@ragesoss or, if you need to disable it only in some particular specs around do |spec|
enabled = SidekiqUniqueJobs.config.enabled
SidekiqUniqueJobs.config.enabled = false
spec.run
SidekiqUniqueJobs.config.enabled = enabled
end |
@roman-melnyk that looks overly complicated :) I'll post a much better solution in a few minutes. |
around do |example|
SidekiqUniqueJobs.disable!(&example)
end That's how you do it @roman-melnyk |
You can also use it in your test it "works" do
SidekiqUniqueJobs.disable! do
# run my code that verifies assumptions
end
end |
Thank you! I saw this section in the README, but I didn't understand the context because it's in the 'Uniqueness' subsection of Testing and the link to the Sidekiq Enterprise thing is broken for me. It might help to put this at the top of testing section and explain the recommendation (turn it off for testing, just like Sidekiq Enterprise) explicitly. |
Reporting back... Here's what my upgrade looked like: WikiEducationFoundation/WikiEduDashboard@daa4b88 It's been running in production this week without any problems. Thanks! |
@ragesoss that's awesome man! Thank you for reporting back and a massive thank you for the link to the PR. That's super helpful for other people who upgrade. |
I have worked really hard for over a year on stabilizing and improving the gem.
Unfortunately, I couldn't really come to terms with the code and the tests in version 6. I kindly ask that any person who has an issue with version 6 considers an upgrade to
>= v7.0.1
. That way, it will be a lot easier for me to help you.Being a sole maintainer with a wife, two kids, other hobbies, and a full-time job makes it really difficult to support the same code in two versions. Since I put so much effort into v7, I suggest you help me make it even better by at least trying it out and reporting if you still have the same problem.
With fewer issues on version six to read and think about, I can put all my focus on version seven! That will quickly turn version seven into our best gem-friend.
Sorry to all you v6 people out there who still have problems. Many people have reported that v7 works better for them, and it does have some much-needed improvements; orphaned locks cleanup for one.
To upgrade, you need to make some changes:
Configuration
I'd say this is a pretty sane configuration for most people starting with version 7.
If you are using other sidekiq middleware, I suggest you read the section Other Sidekiq gems for examples of which order the middleware needs to be added.
The order of said middleware is super important, so don't skip on this, and please let me know if I got something wrong to update the README.
I have done my best to support version six, but I am at my wit's end. I didn't rewrite the codebase just for fun. I did it to be able to fix people's problems. Now has come the time to try to push people over to the next major version.
Help me help you by upgrading!
The text was updated successfully, but these errors were encountered: