开发者

Problems with WEBrick crashing

开发者 https://www.devze.com 2023-02-03 13:03 出处:网络
Here are the details upon start up => Booting WEBrick => Rails 3.0.1 application starting in development on http://0.0.0.0:3000

Here are the details upon start up

=> Booting WEBrick

=> Rails 3.0.1 application starting in development on http://0.0.0.0:3000

=> Call with -d to detach

=> Ctrl-C to shutdown server [2011-01-11 13:43:57] INFO WEBrick 1.3.1

[2011-01-11 13:43:57] INFO ruby 1.9.2 (2开发者_运维知识库010-08-18) [i386-mingw32]

[2011-01-11 13:43:57] INFO WEBrick::HTTPServer#start: pid=10216 port=3000

periodically WEBrick is crashing. The only error message is:

ActionController::RoutingError (No route matches "/thumbnails/missing.png"):

This error message occurs from time to time (I'm using paperclip), but doesn't cause a WEBrick crash each time it occurs. I've spent a little time trying to resolve the routing error - but haven't resolved it yet. I don't think that's the root cause of WEBrick crashing though, since it doesn't happen everytime.

Any help greatly appreciated.


Sorry, I don't know the answer to your question but I can offer a potential workaround you might be happy with: use Mongrel instead of WEBrick. Mongrel runs faster and is completely compatible. And maybe it won't crash when a route isn't found. Most Rails developers haven't used WEBrick in a few years.

To use Mongrel:

gem install mongrel

If Rails finds Mongrel it will use it automatically.

Hope that fixes it!


Mongrel does not solve the problem, at least on Windows 7 with Ruby 1.9.2 p180 and Rails 3.0.9.

I have found out that the code piece which causes the problem is (It is located in C:\Ruby192\lib\ruby\gems\1.9.1\gems\railties-3.0.9\lib\rails\rack\log_tailer.rb):

module Rails
  module Rack
    class LogTailer
      .
      .
      .

      def tail!
        @file.seek @cursor

        if !@file.eof?
          contents = @file.read
          @cursor = @file.tell
          $stdout.print contents
        end
      end
    end
  end
end

If you blank this method, WEBrick works fine again. I have done an intensive test on it with a lot of RoutingError thrown.

You can use this patch. Put it in the environment file:

module Rails
  module Rack
    class LogTailer

      def tail!

      end
    end
  end
end

The downside of this is that you won't see debug messages on your console.

To bypass this problem, you can use log4r to output debug messages on console instead.

Work like a charm for me.


Looks like webrick crash after an error/warning printed to the logger STDOUT. I workaround it by using thin which does't log to STDOUT.

gem install eventmachine --pre
gem install thin
thin start

env: win7x64, ruby 1.9.2 (2011-07-09) [i386-mingw32], Rails 3.0.9


Also see this: https://rails.lighthouseapp.com/projects/8994/tickets/5590-rails-30-crashes-ruby-192p0-on-repeated-browser-refresh

I've had luck with the Thin server.

0

精彩评论

暂无评论...
验证码 换一张
取 消