The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6748
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === When having open file handlers in a service closed, there are SIGHUPs sent to them. Currently it seems systemd intercepts these and SIGHUPs the main process. The process gracefully stops as a result. This code ensures we are watching SIGHUPs and ignores the signal for the time being. This is understandably maybe not the best way to handle this. But it fixes the problem until something better is figured our or if we actually need to pay attention to this signal. Fixes #6743 Signed-off-by: Morten Linderud <mor...@linderud.pw>
From 7897392518ab5b2360292ae5f9435378fefdc1ad Mon Sep 17 00:00:00 2001 From: Morten Linderud <mor...@linderud.pw> Date: Tue, 21 Jan 2020 20:15:02 +0100 Subject: [PATCH] [lxd/main_daemon] Ignore SIGHUP to main daemon When having open file handlers in a service closed, there are SIGHUPs sent to them. Currently it seems systemd intercepts these and SIGHUPs the main process. The process gracefully stops as a result. This code ensures we are watching SIGHUPs and ignores the signal for the time being. Fixes #6743 Signed-off-by: Morten Linderud <mor...@linderud.pw> --- lxd/main_daemon.go | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/lxd/main_daemon.go b/lxd/main_daemon.go index 64876128a9..e7b0f2bebd 100644 --- a/lxd/main_daemon.go +++ b/lxd/main_daemon.go @@ -72,24 +72,33 @@ func (c *cmdDaemon) Run(cmd *cobra.Command, args []string) error { signal.Notify(ch, unix.SIGINT) signal.Notify(ch, unix.SIGQUIT) signal.Notify(ch, unix.SIGTERM) + signal.Notify(ch, unix.SIGHUP) s := d.State() - select { - case sig := <-ch: - if sig == unix.SIGPWR { - logger.Infof("Received '%s signal', shutting down containers", sig) + for { + select { + case sig := <-ch: + if sig == unix.SIGPWR { + logger.Infof("Received '%s signal', shutting down containers", sig) + containersShutdown(s) + networkShutdown(s) + goto exit + } else if sig == unix.SIGHUP { + logger.Infof("Received '%s signal', ignoring", sig) + } else { + logger.Infof("Received '%s signal', exiting", sig) + goto exit + } + + case <-d.shutdownChan: + logger.Infof("Asked to shutdown by API, shutting down containers") + d.Kill() containersShutdown(s) networkShutdown(s) - } else { - logger.Infof("Received '%s signal', exiting", sig) + goto exit } - - case <-d.shutdownChan: - logger.Infof("Asked to shutdown by API, shutting down containers") - d.Kill() - containersShutdown(s) - networkShutdown(s) } +exit: return d.Stop() }
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel