Search code examples
ruby-on-railsdeadlock

what causes 'deadlock; recursive locking' error in a Rails app?


My rails app tracks any delayed_job errors, and we saw this one today for the first time:

deadlock; recursive locking /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/worker.r

The app has been performing flawlessly, with millions of delayed jobs handled w/o error.

Is this just "one of those random things" or is there something different we can/should do to prevent it from happening again?

I'm especially confused because we run only a single worker.

Our setup: Rails 3.2.12, Heroku app, Postgres, several web dynos but only 1 worker dyno.


Solution

  • This is an issue with Rack. See similar bug reports:

    1. https://github.com/rack/rack/issues/658
    2. https://github.com/rack/rack/issues/349