错误ThreadError:尝试解锁由另一个线程锁定的互斥锁

时间:2013-07-02 09:26:38

标签: ruby-on-rails-3 heroku thread-safety mutex rack

自从我上次部署到我的应用程序的生产服务器后,我得到了一个奇怪的错误,我无法重现:

ERROR ThreadError: Attempt to unlock a mutex which is locked by another thread FATAL
» 11:01:11.996 2013-07-02 09:01:11.895493+00:00 app web.1 - - /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/lock.rb:20:in `unlock'
» 11:01:12.095 2013-07-02 09:01:11.989101+00:00 app web.1 - - /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/lock.rb:20:in `ensure in call'
» 11:01:12.194 2013-07-02 09:01:12.089815+00:00 app web.1 - - /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/lock.rb:21:in `call'
» 11:01:12.276 2013-07-02 09:01:12.182996+00:00 app web.1 - - /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/static.rb:63:in `call'
» 11:01:12.372 2013-07-02 09:01:12.277529+00:00 app web.1 - - /app/vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward'
» 11:01:12.482 2013-07-02 09:01:12.371598+00:00 app web.1 - - /app/vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in `fetch'
» 11:01:12.565 2013-07-02 09:01:12.467375+00:00 app web.1 - - /app/vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in `lookup'
» 11:01:12.651 2013-07-02 09:01:12.561334+00:00 app web.1 - - /app/vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!'
» 11:01:12.752 2013-07-02 09:01:12.654779+00:00 app web.1 - - /app/vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
» 11:01:12.850 2013-07-02 09:01:12.748562+00:00 app web.1 - - /app/vendor/bundle/ruby/1.9.1/gems/rack-timeout-0.0.4/lib/rack/timeout.rb:16:in `block in call'
» 11:01:12.942 2013-07-02 09:01:12.841536+00:00 app web.1 - - /app/vendor/ruby-1.9.3/lib/ruby/1.9.1/timeout.rb:69:in `timeout'
» 11:01:13.044 2013-07-02 09:01:12.934504+00:00 app web.1 - - /app/vendor/bundle/ruby/1.9.1/gems/rack-timeout-0.0.4/lib/rack/timeout.rb:16:in `call'
» 11:01:13.146 2013-07-02 09:01:13.028302+00:00 app web.1 - - /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:479:in `call'
» 11:01:13.221 2013-07-02 09:01:13.123097+00:00 app web.1 - - /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:223:in `call'
» 11:01:13.335 2013-07-02 09:01:13.219949+00:00 app web.1 - - /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/content_length.rb:14:in `call'
» 11:01:13.418 2013-07-02 09:01:13.316886+00:00 app web.1 - - /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/rack/log_tailer.rb:17:in `call'
» 11:01:13.518 2013-07-02 09:01:13.410892+00:00 app web.1 - - /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/handler/webrick.rb:59:in `service'
» 11:01:13.602 2013-07-02 09:01:13.508204+00:00 app web.1 - - /app/vendor/ruby-1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
» 11:01:13.699 2013-07-02 09:01:13.603374+00:00 app web.1 - - /app/vendor/ruby-1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
» 11:01:13.799 2013-07-02 09:01:13.696575+00:00 app web.1 - - /app/vendor/ruby-1.9.3/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'

我在heroku上的一个dyno上主持。我正在运行Rails版本Rails 3.2.13。

在之前的请求中,没有并发任务(rake task,rails console,...)在此dyno上运行。

有谁知道问题可能来自何方?

谢谢!

问候!

2 个答案:

答案 0 :(得分:2)

确定。我们通过迁移到其他网络服务器(unicorn)修复了此问题。

答案 1 :(得分:0)

我有完全相同的问题。在我的情况下,问题是我在数据库(MongoDB 2.4.9)上创建索引并阻止整个数据库。索引创建完成后,错误消息再次消失。显然,如果出现阻塞,则会显示此错误消息。

我想这个帖子与这个帖子有关:Page not working Attempt to unlock a mutex which is locked by another thread