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

Catched a deadlock on Sidekiq 7+ set up using middleware. #838

Open
akapitula opened this issue Feb 29, 2024 · 0 comments
Open

Catched a deadlock on Sidekiq 7+ set up using middleware. #838

akapitula opened this issue Feb 29, 2024 · 0 comments

Comments

@akapitula
Copy link

akapitula commented Feb 29, 2024

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

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