Reputation: 245
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 (2010-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.
Upvotes: 1
Views: 1623
Reputation: 173
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
Upvotes: 1
Reputation: 1933
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 [email protected]?
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.
Upvotes: 1
Reputation: 1138
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.
Upvotes: 0
Reputation: 3348
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!
Upvotes: 1