From 8ea3b752055df543bcf0fa22677b972ea04c5fa6 Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Tue, 1 Apr 2025 09:06:51 +0000 Subject: [PATCH] [orchagent.sh] mask SIGHUP before starting orchagent logrotate uses SIGHUP to let orchagent rotate SAI Redis recording. If SIGHUP is sent by logrotate before orchagent register its handler the default action takes place - termination. If we mask the signal in the start script orchagent inherits masked signals and will ignore SIGHUP until signal handler is registered. This is a rare race condition observed during 1000 warm-reboot testing. Signed-off-by: Stepan Blyschak --- dockers/docker-orchagent/orchagent.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dockers/docker-orchagent/orchagent.sh b/dockers/docker-orchagent/orchagent.sh index b0d19823f02..caa3d479048 100755 --- a/dockers/docker-orchagent/orchagent.sh +++ b/dockers/docker-orchagent/orchagent.sh @@ -117,4 +117,7 @@ if [[ x"${ORCHDAEMON_RING_ENABLED}" == x"true" ]]; then ORCHAGENT_ARGS+=" -R" fi +# Mask SIGHUP signal to avoid orchagent termination by logrotate before orchagent registers its handler. +trap '' SIGHUP + exec /usr/bin/orchagent ${ORCHAGENT_ARGS}