unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: Jason Hines <jason@greenhell.com>
Cc: unicorn-public@bogomips.org
Subject: Re: Will restarting a Unicorn process (via HUP signal) wait for worker threads?
Date: Fri, 24 Apr 2015 00:13:33 +0000	[thread overview]
Message-ID: <20150424001333.GA2117@dcvr.yhbt.net> (raw)
In-Reply-To: <CAECjbYjs0V=zbqVo2Z2ZkYrNiSQmNE7QQz-Buuk0=-Y8hbL=DQ@mail.gmail.com>

Jason Hines <jason@greenhell.com> wrote:
> In my application, I have some background jobs which are executed in
> separate threads.  (using SuckerPunch/Celluloid framework)
> 
> If I send a HUP signal to the Unicorn master, the application is reloaded
> and gracefully restarts the workers.    But, if those workers have child
> threads, does Unicorn wait for those threads to finish before the restart
> or are they terminated immediately?

unicorn itself does not know about any threads spawned by the application.

However, you can setup an END/at_exit block in the worker to wait on
those threads since unicorn workers perform graceful exit:

	at_exit do
	  join_all_threads
	end

      reply	other threads:[~2015-04-24  0:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-24  0:04 Will restarting a Unicorn process (via HUP signal) wait for worker threads? Jason Hines
2015-04-24  0:13 ` Eric Wong [this message]

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/unicorn/

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

  git send-email \
    --in-reply-to=20150424001333.GA2117@dcvr.yhbt.net \
    --to=e@80x24.org \
    --cc=jason@greenhell.com \
    --cc=unicorn-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/unicorn.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).