From: Eric Wong <bofh@yhbt.net>
To: "pudiva chip líquida" <pudiva@skylittlesystem.org>
Cc: unicorn-public@yhbt.net
Subject: Re: at_exit ignored on worker processes
Date: Mon, 11 Apr 2022 20:42:36 +0000 [thread overview]
Message-ID: <20220411204236.GA4777@dcvr> (raw)
In-Reply-To: <CAHpAuDGRjr8XmfUcmu+qjSQ+_9wbRykYLDtUMM6sMosfUNg-Ng@mail.gmail.com>
pudiva chip líquida <pudiva@skylittlesystem.org> wrote:
> Dear unicorns,
>
> I was trying to register some code with `at_exit`, so that it would
> execute when my app processes terminated, but I found out that it was
> being run only for the main unicorn process, not the workers, as those
> are terminated with `exit!` (note the !):
>
> https://yhbt.net/unicorn.git/tree/lib/unicorn/http_server.rb?h=v6.0.0#n675
>
> Would you mind me asking why you decided to go with `exit!` instead of
> plain `exit`, and what would be the correct way of executing code on
> worker termination?
That `exit!' is only temporary during worker init on SIGQUIT.
:QUIT is retrapped and made graceful at the end of init_worker_process:
https://yhbt.net/unicorn.git/tree/lib/unicorn/http_server.rb?h=v6.0.0#n694
t/t0020-at_exit-handler.sh should be testing SIGQUIT behavior
SIGTERM/SIGINT remain `exit!' since they're specified as immediate
(well, as soon as Ruby sig handlers fire)
next prev parent reply other threads:[~2022-04-11 20:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-11 19:02 at_exit ignored on worker processes pudiva chip líquida
2022-04-11 20:42 ` Eric Wong [this message]
2022-04-12 0:27 ` pudiva chip líquida
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: http://yhbt.net/unicorn/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220411204236.GA4777@dcvr \
--to=bofh@yhbt.net \
--cc=pudiva@skylittlesystem.org \
--cc=unicorn-public@yhbt.net \
/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
http://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).