unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* Will restarting a Unicorn process (via HUP signal) wait for worker threads?
@ 2015-04-24  0:04 Jason Hines
  2015-04-24  0:13 ` Eric Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Jason Hines @ 2015-04-24  0:04 UTC (permalink / raw)
  To: unicorn-public

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?

Thanks in advance for any light shed here.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Will restarting a Unicorn process (via HUP signal) wait for worker threads?
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2015-04-24  0:13 UTC (permalink / raw)
  To: Jason Hines; +Cc: unicorn-public

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-04-24  0:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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

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