From: Serge Petrenko <sergepetrenko@tarantool.org>
To: Cyrill Gorcunov <gorcunov@gmail.com>,
Konstantin Osipov <kostja.osipov@gmail.com>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH] clear terminal state on panic
Date: Fri, 29 Nov 2019 14:06:56 +0300 [thread overview]
Message-ID: <48080BBC-71D6-48A7-9330-4D76B154E7CF@tarantool.org> (raw)
In-Reply-To: <20191127223131.GG2472@uranus>
Hi! Thanks for your replies!
Fixed:
diff --git a/src/main.cc b/src/main.cc
index 014958a17..a1572b81e 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -589,7 +589,7 @@ load_cfg()
}
void
-free_rl_state(void)
+tarantool_atexit(void)
{
/* Same checks as in tarantool_free() */
if (getpid() != master_pid)
@@ -848,7 +848,14 @@ main(int argc, char **argv)
trigger_create(&break_loop_trigger, break_loop, NULL, NULL);
trigger_add(&box_on_shutdown, &break_loop_trigger);
- atexit(free_rl_state);
+ /*
+ * The call to tarantool_free() below, thanks to
+ * on_shutdown triggers, works all the time
+ * except when we panic. So leave the ever-
+ * necessary cleanups in atexit handler, which
+ * is executed always.
+ */
+ atexit(tarantool_atexit);
if (!loop())
panic("%s", "can't init event loop");
--
Serge Petrenko
sergepetrenko@tarantool.org
> 28 нояб. 2019 г., в 1:31, Cyrill Gorcunov <gorcunov@gmail.com> написал(а):
>
> On Thu, Nov 28, 2019 at 12:51:47AM +0300, Konstantin Osipov wrote:
>>>
>>> Should not we rather provide some tarantool_atexit() helper
>>> from where we would call other cleanup and etc routines?
>>> We already have tarantool_atfork() hook. Not a big deal
>>> but while the code in question is being modified anyway.
>>
>> Why not, still the exit procedure is complicated because of
>> on_shutdown triggers, so it's important that if there are changes
>> to it, they are documented in the code, not in cs comments.
>
> Yes, putting comment into the code why we're to restore the
> terminal settings on panic is quite important.
next prev parent reply other threads:[~2019-11-29 11:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-26 15:15 Serge Petrenko
2019-11-26 20:56 ` Konstantin Osipov
2019-11-27 16:07 ` Cyrill Gorcunov
2019-11-27 21:51 ` Konstantin Osipov
2019-11-27 22:31 ` Cyrill Gorcunov
2019-11-29 11:06 ` Serge Petrenko [this message]
2019-11-29 11:15 ` Cyrill Gorcunov
2019-11-29 12:20 ` Serge Petrenko
2019-11-29 13:00 ` Cyrill Gorcunov
2019-11-29 14:53 ` Konstantin Osipov
2019-12-10 14:03 ` Kirill Yukhin
2019-12-23 14:29 ` Alexander Turenko
2020-01-13 11:14 ` Alexander Turenko
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48080BBC-71D6-48A7-9330-4D76B154E7CF@tarantool.org \
--to=sergepetrenko@tarantool.org \
--cc=gorcunov@gmail.com \
--cc=kostja.osipov@gmail.com \
--cc=tarantool-patches@dev.tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH] clear terminal state on panic' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox