From: Robert Klemme Date: 2011-11-06T00:52:10+09:00 Subject: Re: Rack::Handler::Xxx On Sat, Nov 5, 2011 at 3:30 PM, Nokan Emiro wrote: > Hi, > > I would like to run a Rack application, that can be buggy, and > sometimes throws an exception.  I want to catch it, and force > my whole Rack app to continue running.  This is the schema: > > app = ...a Rack app definition goes here... > > require 'rack' > begin >   Rack::Handler::FastCGI.run app, :Port => 9811 > rescue Exception => e >   $stderr.puts "...print info about the exception #{e}..." >   retry > end > > This way I can catch the exception, but when the retry is reached the > Rack::Handler::FastCGI line again, it fails because of the port 9811 > is already in use. > > How can I close that port (stop Rack server thread?), and tell Rack > to reopen it? I don' t know Rack but why not just wrap app in something which delgates to app, catches exceptions and retries? Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/