From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS14383 205.234.109.0/24 X-Spam-Status: No, score=-0.7 required=5.0 tests=RP_MATCHES_RCVD shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: archivist@yhbt.net Delivered-To: archivist@dcvr.yhbt.net Received: from rubyforge.org (rubyforge.org [205.234.109.19]) by dcvr.yhbt.net (Postfix) with ESMTP id 7DC432106F for ; Mon, 26 Sep 2011 06:37:31 +0000 (UTC) Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id DE5201D78101; Mon, 26 Sep 2011 02:37:30 -0400 (EDT) X-Original-To: mongrel-unicorn@rubyforge.org Delivered-To: mongrel-unicorn@rubyforge.org X-Greylist: delayed 6769 seconds by postgrey-1.31 at rubyforge.org; Mon, 26 Sep 2011 02:06:12 EDT Received: from mail-ey0-f178.google.com (mail-ey0-f178.google.com [209.85.215.178]) by rubyforge.org (Postfix) with ESMTP id CFAA2185837A for ; Mon, 26 Sep 2011 02:06:12 -0400 (EDT) Received: by eye27 with SMTP id 27so3777152eye.23 for ; Sun, 25 Sep 2011 23:06:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.204.153.23 with SMTP id i23mr4066149bkw.128.1317017170383; Sun, 25 Sep 2011 23:06:10 -0700 (PDT) Received: by 10.204.114.200 with HTTP; Sun, 25 Sep 2011 23:06:10 -0700 (PDT) In-Reply-To: <20110926014259.GB19028@dcvr.yhbt.net> References: <4D4841AA1FE04C98BF883BDE8B17741E@gmail.com> <20110926014259.GB19028@dcvr.yhbt.net> Date: Sun, 25 Sep 2011 23:06:10 -0700 Message-ID: Subject: Re: Timeout callback From: Christopher Bailey To: unicorn list X-BeenThere: mongrel-unicorn@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: mongrel-unicorn-bounces@rubyforge.org Errors-To: mongrel-unicorn-bounces@rubyforge.org Alex, we were having problems with timeouts, and it killing our logs, making it near impossible to figure out what was causing the timeout, etc. We too looked into a solution within Unicorn, but as Eric explains, it's not possible. What we wound up doing, which may or may not work for you, is to put an explicit Timeout wrapper around the code we knew caused this (we are lucky and knew a specific API call/controller action that was getting the timeouts). =A0e.g. wrap with: =A0 Timeout::timeout(...) do This wound up actually being a far better solution for us, because our mobile clients that call this API timeout the HTTP request at 20 seconds anyway, so it was pointless to even get to 60. =A0So, we now have a far better solution, one where we can time it out ourselves, handle the exception, and log the timeout/problem (e.g. we create a Zendesk ticket, etc.). =A0Anyway, figured I'd mention that in case it could work in your case as well... On Sun, Sep 25, 2011 at 6:42 PM, Eric Wong wrote: > > Alex Sharp wrote: > > =A0Would there be any support for a worker-level timeout callback, for > > =A0workers that get killed by the master process for violating the > > =A0Unicorn::Configurator.timeout setting? > > Something like this /cannot/ be done right. =A0The unicorn timeout uses > SIGKILL because SIGKILL is a last resort and not > catchable/blockable/trappable in user space. =A0(SIGSTOP is in the same > boat as SIGKILL). > > > I'm thinking the method could be on the Unicorn::Configurator class, > > something like ".at_timeout_exit". My thinking here is I want to be > > able to invoke caller() and get a backtrace to figure out the code > > that's resulting in timeouts. > > Getting a backtrace relies on Ruby being in a runnable state. > If user space (and Ruby) is capable of accepting non-SIGKILL/SIGSTOP, > you could already be using something along the lines of the Timeout > module in Ruby stdlib, SystemTimeout, or the Rainbows::ThreadTimeout > middleware. > > In other words, you can already use an application-level timeout > (even around the entire app dispatch) if you could get a backtrace. > _______________________________________________ > Unicorn mailing list - mongrel-unicorn@rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-unicorn > Do not quote signatures (like this one) or top post when replying -- Christopher Bailey Cobalt Edge LLC http://cobaltedge.com _______________________________________________ Unicorn mailing list - mongrel-unicorn@rubyforge.org http://rubyforge.org/mailman/listinfo/mongrel-unicorn Do not quote signatures (like this one) or top post when replying