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: AS43802 178.219.240.0/20 X-Spam-Status: No, score=-0.8 required=3.0 tests=AWL,BAYES_00, RCVD_IN_BRBL_LASTEXT,RCVD_IN_XBL,RDNS_NONE shortcircuit=no autolearn=no version=3.3.2 X-Original-To: rainbows-public@bogomips.org Received: from 80x24.org (unknown [178.219.245.214]) by dcvr.yhbt.net (Postfix) with ESMTP id B9C7420421 for ; Thu, 15 Oct 2015 01:37:36 +0000 (UTC) From: Eric Wong To: rainbows-public@bogomips.org Subject: [PATCH] speed up QUIT for users of the unicorn worker_loop Date: Thu, 15 Oct 2015 01:37:33 +0000 Message-Id: <20151015013733.27968-1-e@80x24.org> List-Id: WriterThreadPool, WriterThreadSpawn, Base, and potentially other rarely-used concurrency options experienced slow shutdowns due to the destruction of a listener socket failing to wake up a thread in IO.select. Send ourselves a signal to interrupt the IO.select call in the main thread to force the wakeup. --- lib/rainbows.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/rainbows.rb b/lib/rainbows.rb index 3bebf34..0af5620 100644 --- a/lib/rainbows.rb +++ b/lib/rainbows.rb @@ -93,6 +93,9 @@ module Rainbows @readers.clear tmp.each { |s| s.close rescue nil }.clear @at_quit.each { |task| task.call } + + # XXX hack to break out of IO.select in worker_loop for some models + Process.kill(:QUIT, $$) end false end -- EW