mirror of
https://github.com/OpenVPN/openvpn.git
synced 2026-05-28 04:03:29 -04:00
Map restart signals from event loop to SIGTERM during exit-notification wait
Commit 63b3e000c9.. fixed SIGTERM getting lost during exit notification by ignoring any restart signals triggered during this interval. However, as reported in Trac 777, this could result in repeated triggering of restart signals when the event loop cannot continue without restart due to IO errors or timeout. Avoid by converting soft SIGUSR1 and SIGHUP signals received during exit-notify wait period to SIGTERM. Trac #777 Signed-off-by: Selva Nair <selva.nair@gmail.com> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <1480386424-30876-1-git-send-email-selva.nair@gmail.com> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13284.html Signed-off-by: Gert Doering <gert@greenie.muc.de>
This commit is contained in:
parent
6c6456f438
commit
f25a0217e3
1 changed files with 16 additions and 5 deletions
|
|
@ -378,7 +378,8 @@ process_sigterm (struct context *c)
|
|||
|
||||
/**
|
||||
* If a restart signal is received during exit-notification, reset the
|
||||
* signal and return true.
|
||||
* signal and return true. If its a soft restart signal from the event loop
|
||||
* which implies the loop cannot continue, remap to SIGTERM to exit promptly.
|
||||
*/
|
||||
static bool
|
||||
ignore_restart_signals (struct context *c)
|
||||
|
|
@ -388,10 +389,20 @@ ignore_restart_signals (struct context *c)
|
|||
if ( (c->sig->signal_received == SIGUSR1 || c->sig->signal_received == SIGHUP) &&
|
||||
event_timeout_defined(&c->c2.explicit_exit_notification_interval) )
|
||||
{
|
||||
msg (M_INFO, "Ignoring %s received during exit notification",
|
||||
signal_name(c->sig->signal_received, true));
|
||||
signal_reset (c->sig);
|
||||
ret = true;
|
||||
if (c->sig->source == SIG_SOURCE_HARD)
|
||||
{
|
||||
msg (M_INFO, "Ignoring %s received during exit notification",
|
||||
signal_name(c->sig->signal_received, true));
|
||||
signal_reset (c->sig);
|
||||
ret = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
msg (M_INFO, "Converting soft %s received during exit notification to SIGTERM",
|
||||
signal_name(c->sig->signal_received, true));
|
||||
register_signal(c, SIGTERM, "exit-with-notification");
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Reference in a new issue