题
我包括这个简单Rack中间件在Rails应用程序:
class Hello
def initialize(app)
@app = app
end
def call(env)
[200, {"Content-Type" => "text/html"}, "Hello"]
end
end
插入在它里面的environment.rb:
...
Dir.glob("#{RAILS_ROOT}/lib/rack_middleware/*.rb").each do |file|
require file
end
Rails::Initializer.run do |config|
config.middleware.use Hello
...
我使用的Rails 2.3.5,1.3.1的WEBrick,红宝石1.8.7
当应用程序在生产模式下启动,一切正常 - 每个请求由你好中间件拦截,“你好”返回。但是,在发展模式下运行,第一个请求返回作品“你好”,但接下来的请求挂起。
遮断的WEBrick而其处于挂起状态的产率如下:
^C[2010-03-24 14:31:39] INFO going to shutdown ...
deadlock 0xb6efbbc0: sleep:- - /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/reloader.rb:31
deadlock 0xb7d1b1b0: sleep:J(0xb6efbbc0) (main) - /usr/lib/ruby/1.8/webrick/server.rb:113
Exiting
/usr/lib/ruby/1.8/webrick/server.rb:113:in `join': Thread(0xb7d1b1b0): deadlock (fatal)
from /usr/lib/ruby/1.8/webrick/server.rb:113:in `start'
from /usr/lib/ruby/1.8/webrick/server.rb:113:in `each'
from /usr/lib/ruby/1.8/webrick/server.rb:113:in `start'
from /usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
from /usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
from /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/handler/webrick.rb:14:in `run'
from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:111
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from script/server:3
事做在开发模式中的类reloader。还有在异常死锁提
任何想法可能会导致什么呢?作为最好的办法任何建议调试呢?
<强>更新强>
$ script/console
Loading development environment (Rails 2.3.5)
>> app.get '/'
=> 200
>> app.get '/'
ThreadError: stopping only thread
note: use sleep to stop forever
from /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/reloader.rb:31:in `lock'
from /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/reloader.rb:31:in `run'
from /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:108:in `call'
from /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/lint.rb:47:in `_call'
from /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/lint.rb:35:in `call'
from /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/integration.rb:316:in `process'
from /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/integration.rb:197:in `get'
from (irb):2
像它看起来可能与此问题:
https://rails.lighthouseapp.com /项目/ 8994 /张/ 3153-actioncontrollerintegrationsession破碎式-234
解决方案
我已经想出了一个黑客工具,将被暂时让我。它是在上述票。
https://rails.lighthouseapp.com /项目/ 8994 /张/ 3153-actioncontrollerintegrationsession破碎式-234
不隶属于 StackOverflow