Catched a deadlock on Sidekiq 7+ set up using middleware.
akapitula opened this issue · 0 comments
akapitula commented
Describe the bug
In my configuration the deadlock was not supposed to happen but still was happening, the gem was configured using sidekiq middleware.
sidekiq (7.2.1)
sidekiq-unique-jobs (8.0.9)
Expected behavior
Not to lock the job. But it still was locked for hours, untill i've resetted the redis.
Current behavior
2024-02-29T08:46:04.343Z pid=23072 tid=cng uniquejobs=client until_executed=uniquejobs:a95805955a77049ece74f49084024c62 INFO: Skipping job with id (281f76da6925b8a897df39d1) because lock_digest: (uniquejobs:a95805955a77049ece74f49084024c62) already exists
Worker class
class PendingPropositionWorker
include Sidekiq::Worker
sidekiq_options lock: :until_executed, on_conflict: :log
def perform
PropositionProcessService.call
end
end
sidekiq.rb initializer:
require "sidekiq-unique-jobs"
redis_config = { url: ENV['REDIS_URL'], network_timeout: 5, pool_timeout: 5 }
Sidekiq.default_job_options = { backtrace: true, retry: 5 }
Sidekiq.configure_server do |config|
config.redis = redis_config
config.error_handlers << Proc.new { |ex, ctx_hash| Rollbar.error(ex, params: ctx_hash)}
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
Sidekiq.configure_client do |config|
config.redis = redis_config
config.client_middleware do |chain|
chain.add SidekiqUniqueJobs::Middleware::Client
end
end
Additional context
In the sidekiq interface the lock was not shown