Ryan Rebo
Ryan Rebo

Reputation: 1318

Is it safe to remove Rack::Lock?

I'm getting this error on a pretty regular basis: ThreadError: deadlock; recursive locking. I read that if using Unicorn (which I am) that Rack::Lock is not needed. I can remove it by adding config.middleware.delete "Rack::Lock" to application.rb.

Does anyone have opinions on if it is safe to remove Rack::Lock from my production app?

For reference, the common trace:

…dor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/lock.rb:14:in `lock'
…dor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/lock.rb:14:in `call'
…bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/deflater.rb:13:in `call'
…/bundle/ruby/2.0.0/gems/rack-ssl-1.3.3/lib/rack/ssl.rb:27:in `call'
…by/2.0.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward'
…by/2.0.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in `fetch'
…by/2.0.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in `lookup'
…by/2.0.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!'
…by/2.0.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
…by/2.0.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:552:in `process_client'
…icorn-worker-killer-0.4.2/lib/unicorn/worker_killer.rb:51:in `process_client'
…icorn-worker-killer-0.4.2/lib/unicorn/worker_killer.rb:124:in `process_client'
…by/2.0.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:632:in `worker_loop'
…by/2.0.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:500:in `spawn_missing_workers'
…by/2.0.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:142:in `start'

Upvotes: 1

Views: 899

Answers (1)

Ryan Rebo
Ryan Rebo

Reputation: 1318

Ok, I removed config.middleware.delete "Rack::Lock" about a week ago and all seems to be working ok. The error is gone and removing Rack::Lock has caused no issues.

Upvotes: 1

Related Questions