-
-
Notifications
You must be signed in to change notification settings - Fork 277
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
Timed out after 0s while waiting for primed token #601
Comments
Hi @joshhubers, this is actually a feature, not a bug. Please see this comment #571 (comment). This happens for locks that have a specific or unique job during execution. If the server process can't achieve a lock in the allowed time, it logs a warning. I am looking into providing a better mechanism for when this occurs. In general, I am looking at letting the users subscribe to an event and deal with it any way they want. Like I wrote in the linked comment, perhaps the log level is wrong, which people find confusing. Anyway, I will improve this next. I have just been swamped with paid work for a while. |
Thank for for the quick response. I had read that comment earlier, I guess I'm just struggling to understand why it's happening and what I can do to resolve the issue? Are there other logs that describe the root of the issue I'm missing? Are the client or server queues full for some reason? Am I submitting multiple jobs with non-unique arguments which cause multiple jobs with the same lock digest? Just trying to figure out the root of the issue. Would setting Thank you for all your hard work. |
It might help in certain scenarios. It depends on how many duplicates are coming in at the same time etc. In your example above you'd just slow things down a little. There is conflict resolution you can configure and such things. |
Hello, we have similar issue with this warning logs, but changing When logging config value in
I got:
Then I notice value of Changing config to |
I've been looking at this issue all week and I can't seem to find the root of the issue. I've tried logging out the worker arguments that are hashed into the unique lock digest and all the arguments are unique, yet somewhere something is locking the worker out from performing. From logging I can see I start about 10 workers with unique arguments, it's flaky, but about the first 2/3rds will execute, and then I get the I've tried looking in the web interface for anything that would stick out, but I haven't found anything. No exceptions from the workers, no retries occurring, no duplicated arguments or repeated performs. I'm stumped. I have yet to verify it, but it seems like the issue started when we upgraded from version 6 to 7. |
It should hopefully be solved in |
Fantastic! That was fast! No, Thank you @mhenrixon ! |
Hi @mhenrixon,
Config
Worker
We are still running sidekiq 5.2.9. Any thoughts or suggestions? |
After further investigation, I am seeing this same |
@brycemelvin you are correct, it is just a warning |
I'm also seeing this warning. However, it doesn't seem to be restricted to the situation when an identical job is getting enqueued. I tried simulating this through a test which enqueues exactly 1 job and ran that test in isolation (flushing the redis cache before and after running the test). Got the warning every time. Using sidekiq 6.2.1 and sidekiq-unique-jobs 7.0.11. P.S. thank you for the amazing work! |
Just ran another test where I enqueued 100 jobs that each updated their own database record. In every case where the warning was received, the database record was not updated meaning the job itself didn't run. This does not seem to be an ignorable warning. |
@jerryjohnjacob thanks for the report. I will do some more debugging on the issue given your test example. |
Sorry I never circled back on this issue. Upgrading to the version |
@joshhubers That is super helpful feedback! Thank you |
Hey, did you resolve the problem? |
@krutovgerman Not exactly. I had to downgrade to the version I was using before, which is quite old, so not a "solution" I would recommend. |
@mhenrixon Did some additional testing. Looks like the issue was introduced in v7.0.8. I ran similar tests to what I'd previously mentioned and noticed that the issue of the jobs not getting executed started with this version. With v7.0.7, the warnings would appear in cases where there were duplicate jobs being enqueued, but at least one of those jobs would get properly executed. Hope this helps. |
|
@mhenrixon: @joshhubers says v7.0.10 solves the problem for him, but it does not for me. I only get the behaviour he described with v7.0.7. So I'm wondering whether the issue is beyond the scope of just sidekiq-unique-jobs. e.g., there might be a dependency on the Sidekiq and/or Ruby versions. For reference, I'm using sidekiq 6.2.1 and ruby-2.7.1. If there is any other information that I can provide, please let me know. This is an amazing library and we appreciate you and all the work you do! |
I'm getting this warning too. I understand this is the expected behaviour when there is already a job in the queue (the same job with the same args), but what I see is the lock is not removed after the job finishes. I see the lock remains in the Using sidekiq 6.2.0, sidekiq-unique-jobs 7.0.11, Ruby 3.0.1. P.S. thank you for this amazing gem @mhenrixon |
@monsha @jerryjohnjacob Thanks for the details. I'll do some experiments this week. |
This looks like debug information to me:
There is no way I can use this so the value to me is 0. But our server logs are literally flooded by these. We need a way to silence this completely. For INFO log level it could show something like a job with args But since this is expected behavior it shouldn't be a warning, I want all duplicate jobs to be silently discarded and I don't need to know about that. It's enough that when a job failed to be queued I'm getting |
@heaven would it work if I set the log level to debug perhaps? There is also a PR to enable silencing of these particular log entries but I'd prefer to find a more suitable solution. |
@mhenrixon there are 2 issues I'm facing:
Regarding the first problem, I think it would make sense to silence the warning when the timeout is config.debug_lua = !Rails.env.prod? # true for debugging
config.lock_info = !Rails.env.prod? # true for debugging For the second problem, I've found that more useful information could be added, e.g. I was missing |
@heaven I am working on a kind of event system for the gem that instead of logging will give you the event that generated the entry and the item/job itself. That way you can do whatever you want with it and I will remove the logging. Would something like that work better perhaps? |
@mhenrixon I'm sure that would be awesome. Well, you can still keep the logging but in this case, make it using the debug level and allow turning it on/off like with the config settings above. Might be useful in some scenarios helping to identify that there's a problem. While the event system will help to deal with it. But in the meantime, if you can allow us to silence this warning that'd be a huge relief because our logs are bloated. |
I will reduce the log level to debug immediately @heaven. Sorry about the noise |
Released as v7.0.12 |
@mhenrixon amazing, thank you, man! |
My pleasure @heaven! Always happy to help |
Hi @mhenrixon! Were you able to find a solution for the issue of jobs getting dropped? I retried the same tests with the latest version of the gem and with more records (30000+ instead of 100). The warnings no longer appear, but the issue still exists. Some jobs were dropped and the database records were not updated. |
@jerryjohnjacob it is on my radar. I've unfortunately had a bad stroke of luck in the last couple of months. Been sick 3 weeks with the flu, lost my dog and was out another week for tweaking my back. I'm back now and can't wait to dig into some of these problems. |
Oh goodness, I'm so sorry to hear that! Please, take your time. No urgency on this matter.
…________________________________
From: Mikael Henriksson ***@***.***>
Sent: Saturday, September 18, 2021 11:49:33 AM
To: mhenrixon/sidekiq-unique-jobs ***@***.***>
Cc: Jerry John Jacob ***@***.***>; Mention ***@***.***>
Subject: Re: [mhenrixon/sidekiq-unique-jobs] Timed out after 0s while waiting for primed token (#601)
@jerryjohnjacob<https://github.com/jerryjohnjacob> it is on my radar. I've unfortunately had a bad stroke of luck in the last couple of months.
Been sick 3 weeks with the flu, lost my dog and was out another week for tweaking my back.
I'm back now and can't wait to dig into some of these problems.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#601 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABF3RACCWUDLAG3YY4YDPRLUCQVPLANCNFSM44FXXQVQ>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Version 7.1.7 partly fixes similar issues (#640) that jobs are silently dropped when using replace strategy. In the original question, no strategy is in use so it is likely also something else. |
@mhenrixon Hope you're doing better now! Just tried v7.1.7. Still seeing the issue. Here are the stats for a job count of 34493: I still wonder if it has something to do with the configuration I'm using. Here are the latest details: Sidekiq config: Sidekiq::Client.reliable_push!
Sidekiq.configure_client do |config|
config.client_middleware do |chain|
chain.add SidekiqUniqueJobs::Middleware::Client
end
end
Sidekiq.configure_server do |config|
config.reliable_scheduler!
config.super_fetch!
config.client_middleware do |chain|
chain.add SidekiqUniqueJobs::Middleware::Client
end
config.server_middleware do |chain|
chain.add SidekiqUniqueJobs::Middleware::Server
end
SidekiqUniqueJobs::Server.configure(config)
end Worker: class UpdateRecordWorker
include Sidekiq::Worker
sidekiq_options lock: :until_and_while_executing, unique_across_queues: true, queue: 'high_priority'
def perform(record_id)
Record.find(record_id).update_column(:my_db_column, true)
end
end Final script: Record.update_all(my_db_column: false) # reset
Record.ids.each { |record_id| UpdateRecordWorker.perform_async(record_id) } This configuration works with v7.0.7 of the gem, the only issue being the warning being printed constantly in the logs, e.g.:
|
@mhenrixon Were you able to look into this afterwards? I ran into the issue reported here and have to upgrade, but I'm still facing the issue of workers randomly failing to run. On the latest test, found that 1978 out of 34493 jobs were not run. This only happens when I add the uniqueness options, so I think we can rule out the root cause directly coming from somewhere else. |
@jerryjohnjacob not yet but I am slowly getting to it. Starting a company and doing full time freelancing isn't easy but I finally have a project again that uses the gem so I'll get to it at some point. |
Wow, mega stuff @mhenrixon! 🎉 |
Describe the bug
When executing some workers we are getting a
Timed out after 0s while waiting for primed token
warning.Expected behavior
Workers should be executed appropriately.
Current behavior
It appears that jobs are started, the warning is thrown, no worker code is executed, and then the job finishes without executing.
Worker class
Additional context
This warning and lack of execution is only happen sometimes but not always. Inside of
FeedService::Publish.call(live_object)
we created nested workers from an iteration. The number of nested workers range from 1~20. They are alsountil_and_while_executing
locks. Usually what happens is the first few nested workers will execute and the rest will not perform. Sometimes even the "top level" worker above however does not perform.Configuration:
version
7.0.9
Any pointers or thoughts would be immensely appreciated! Thank you for your hard work on this spectacular gem!
The text was updated successfully, but these errors were encountered: