Rainbows! Rack HTTP server user/dev discussion
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
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	[thread overview]
Message-ID: <20151015013733.27968-1-e@80x24.org> (raw)

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


                 reply	other threads:[~2015-10-15  1:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  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=20151015013733.27968-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=rainbows-public@bogomips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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

	https://yhbt.net/rainbows.git/

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