Search code examples
ruby-on-railsdebuggingsidekiq

How to debug sidekiq?


Today airbrake reported an exception. Its summary said that the problem occures when sidekiq tries retry the job after a failure. Here's what summary params look like:

{
 "retry"=>"true",
 "queue"=>"default",
 "class"=>"AdwordsReportWorker",
 "args"=>"[\"2\", \"2012-11-13\"]",
 "jid"=>"51d568e46c412adc327153c8",
 "error_message"=>"wrong number of arguments(1 for 0)",
 "error_class"=>"ArgumentError",
 "failed_at"=>"2012-11-14 13:56:12 UTC",
 "retry_count"=>"0",
 "controller"=>"",
 "action"=>""
}

I seems that the exception is only taking palce when the job fails and retries. I would like to debug this, but I can't get my head around where to start :-(

My questions are:

  1. Under what conditions worker understands it failed finishing the job (from which he descides to retry)? How do I force the worker to fail in attempt to, say, reproduce the problem?
  2. Is there a good tutorial on debugging/examples sidekiq workers?
  3. I am using sidekiq 2.3.3. Will upgrading to newer version solve the problem?

Bonus track. The actual stacktrace unexpectedly ends up in

[GEM_ROOT]/gems/activerecord-3.2.8/lib/active_record/associations/association.rb:98:in `initialize'

Solution

  • I couldn't find how do debug sidekiq, but apperently the problem I am referring to is a known bug in Rails.

    Here are a few lines: