On Sat, Nov 5, 2011 at 3:30 PM, Nokan Emiro <uzleepito / gmail.com> wrote:
> Hi,
>
> I would like to run a Rack application, that can be buggy, and
> sometimes throws an exception.     > my whole Rack app to continue running.   >
> 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/