Rainbows! Rack HTTP server user/dev discussion
 help / color / Atom feed
* Timeout on Rainbows!
@ 2013-08-23 19:13 Lin Jen-Shin (godfat)
       [not found] ` <CAA2_N1t7+9iGSGo-fzOuKFzxrtQkp==G0+8xOun3MfZ=rWq25A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Lin Jen-Shin (godfat) @ 2013-08-23 19:13 UTC (permalink / raw)
  To: Rainbows! list

Hi,

I am reworking on thread pool for EventMachine, and just realized that
Rainbows doesn't try to put a timeout for each request. Previously,
I thought the timeout setup in Unicorn would be used for each request.

Then I found Rainbows::ThreadTimeout is probably what I want.
I wonder, does that make sense to do something like this, wrap the
application with Rainbows::ThreadTimeout with the same timeout
time in Unicorn automatically?

  def worker_loop worker
    build_app! # This is needed for preload_app=false
    server = Rainbows.server
    server.app = Rainbows::ThreadTimeout.new(server.app,
                   :timeout => server.config.set[:timeout])
    super
  end

I did this in my attempt for EventMachineThreadPool:
https://github.com/godfat/rainbows-emtp/blob/rainbows-emtp-0.5.0/lib/rainbows/event_machine_thread_pool.rb#L14-L20

Because I saw this in EventMachine model:

  def worker_loop(worker) # :nodoc:
    init_worker_process(worker)
    server = Rainbows.server
    server.app.respond_to?(:deferred?) and
      server.app = TryDefer.new(server.app)
  [...]

and I think in most cases we would want this timeout for each
request. The down side might be that then the users cannot
use their own Rainbows::ThreadTimeout (maybe?) or setup a custom
threshold.

Probably then we could introduce another timeout/threshold config
in Configurator? I feel it would be common enough.

Thoughts? Thanks!
_______________________________________________
Rainbows! mailing list - rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
http://rubyforge.org/mailman/listinfo/rainbows-talk
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-23 19:13 Timeout on Rainbows! Lin Jen-Shin (godfat)
     [not found] ` <CAA2_N1t7+9iGSGo-fzOuKFzxrtQkp==G0+8xOun3MfZ=rWq25A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-08-23 19:35   ` Eric Wong
     [not found]     ` <20130823193519.GA30201-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
2013-08-23 20:02       ` Lin Jen-Shin (godfat)

Rainbows! Rack HTTP server user/dev discussion

Archives are clonable:
	git clone --mirror http://bogomips.org/rainbows-public
	git clone --mirror http://ou63pmih66umazou.onion/rainbows-public

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.rainbows
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.rainbows

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git