Rainbows! Rack HTTP server user/dev discussion
 help / color / mirror / code / Atom feed
From: Eric Wong <normalperson-rMlxZR9MS24@public.gmane.org>
To: Rainbows! list <rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org>
Subject: Re: Timeout on Rainbows!
Date: Fri, 23 Aug 2013 19:35:19 +0000	[thread overview]
Message-ID: <20130823193519.GA30201@dcvr.yhbt.net> (raw)
In-Reply-To: <CAA2_N1t7+9iGSGo-fzOuKFzxrtQkp==G0+8xOun3MfZ=rWq25A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

"Lin Jen-Shin (godfat)" <godfat-hOE/xeEBYYIdnm+yROfE0A@public.gmane.org> wrote:
> 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.

The normal timeout is only a last resort (it works when the VM is hosed
on a worker).  ThreadTimeout isn't nearly as reliable because it works
on the same VM/process, and it's still always preferable to rely on
"local" timeouts exposed by every library.  (see

> 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?


> 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)
>   [...]

That's only because other servers (Thin) support this non-standard
extension by default.  Otherwise, I've always been strongly against
adding non-standard extensions/features into the Rack middleware stack.

> 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.

Right.  And some users (e.g. myself) don't ever use either timeout
feature.  We audit every single line of code and make sure all
potentially long-running method calls have timeouts set appropriately.
(IMNSHO, this is the _only_ way to write applications for a
multi-threaded/evented platform)

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

Not worth it.  It's not reliable enough nor generally useful enough
compared to the regular timeout (which again, is a last resort).
Rainbows! mailing list - rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
Do not quote signatures (like this one) or top post when replying

  parent reply	other threads:[~2013-08-23 19:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
     [not found]     ` <20130823193519.GA30201-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
2013-08-23 20:02       ` Lin Jen-Shin (godfat)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://yhbt.net/rainbows/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130823193519.GA30201@dcvr.yhbt.net \
    --to=normalperson-rmlxzr9ms24@public.gmane.org \
    --cc=rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).