From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS33070 50.56.128.0/17 X-Spam-Status: No, score=0.7 required=3.0 tests=AWL,MSGID_FROM_MTA_HEADER, RDNS_NONE shortcircuit=no autolearn=no version=3.3.2 Path: news.gmane.org!not-for-mail From: "Lin Jen-Shin (godfat)" Newsgroups: gmane.comp.lang.ruby.rainbows.general Subject: Timeout on Rainbows! Date: Sat, 24 Aug 2013 03:13:19 +0800 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1377285236 8181 80.91.229.3 (23 Aug 2013 19:13:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 23 Aug 2013 19:13:56 +0000 (UTC) To: "Rainbows! list" Original-X-From: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Fri Aug 23 21:14:00 2013 Return-path: Envelope-to: gclrrg-rainbows-talk@m.gmane.org X-Original-To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Delivered-To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org X-Greylist: delayed 73189 seconds by postgrey-1.31 at rubyforge; Fri, 23 Aug 2013 19:13:51 UTC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=godfat.org; s=google; h=mime-version:from:date:message-id:subject:to:content-type; bh=Z+rzJxG8bl3FY1kcsYXyhXVfGI96NaiP2tsvJ3P5y/k=; b=Y67fjl7FoQzBJrfaLNwgDjTAkuGPlK8Wjfm4rrCu6Qe4NJTpWWCMa2BvmHJs0SU6WM ita/tIgO+8rvdq2IYekwO9ZrG1NOgG9RjkQ4p5TyrwIvIWbF34+T7kRjcogG14hmmONn 9ntDFx5PhWlhbvZq9DKy/ltzIqtOxbb0+65tI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-type; bh=Z+rzJxG8bl3FY1kcsYXyhXVfGI96NaiP2tsvJ3P5y/k=; b=R/h2rZZt1qVqwzUTESrinRdnxtttifHuAkb5Q0TMYcakkv5PRoOaZUzQ7XQTdNhU+u wgDnFiBCBdk8Cyfyp4bZzVMBtAcRB2Ct6ViWakc/Qv97gyiAi+G6sc9D9hXfvlzwSHKK QebLKe10WAZqUk4FNYxmb1pbCSyljIQzjsKHfZkGGictpXovDh+Ve6WYk07oY9l0KBC7 PmypipbO2uxi0daMhhGL1vF4slN3fVveEELuZCWYk+JiW34gc9qm4vFki7C01KbFD8Gq wDWPkrXlHGKo4lde45rXvbRK2KcNMwou41CjVCaIWBlStfkzE4vEAzwe4G1TIxUet4x5 K2dw== X-Gm-Message-State: ALoCoQmTpeV5Z7rdW7Ce5k6dFHVyr/DRdrFoHhZgRA5oFPdkyQ8GEH/cAXsbGSTkBmiSOTOo5Q9V X-Received: by 10.15.53.132 with SMTP id r4mr257637eew.115.1377285229589; Fri, 23 Aug 2013 12:13:49 -0700 (PDT) X-BeenThere: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Errors-To: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org X-Broken-Reverse-DNS: no host name found for IP address 50.56.192.79 Xref: news.gmane.org gmane.comp.lang.ruby.rainbows.general:517 Archived-At: Received: from [50.56.192.79] (helo=rubyforge.org) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VCwo3-00079W-NK for gclrrg-rainbows-talk@m.gmane.org; Fri, 23 Aug 2013 21:14:00 +0200 Received: from localhost.localdomain (localhost [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id C0AA52E19A; Fri, 23 Aug 2013 19:13:59 +0000 (UTC) Received: from mail-ea0-f182.google.com (mail-ea0-f182.google.com [209.85.215.182]) by rubyforge.org (Postfix) with ESMTP id AE5D72E145 for ; Fri, 23 Aug 2013 19:13:51 +0000 (UTC) Received: by mail-ea0-f182.google.com with SMTP id o10so459374eaj.41 for ; Fri, 23 Aug 2013 12:13:49 -0700 (PDT) Received: by 10.223.172.69 with HTTP; Fri, 23 Aug 2013 12:13:19 -0700 (PDT) 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