From 7a21cab07dbd0ace80833a57e391dec0ebde9978 Mon Sep 17 00:00:00 2001 From: Feng-msft Date: Tue, 14 Jan 2025 08:46:14 +0800 Subject: [PATCH] Fix docker auto restart issue (#21377) Why I did it if critical process crashes or killed, bmp docker container will not be auto-restarted. How I did it /usr/bin/supervisor-proc-exit-listener takes in charge of critical process monitor and event publish, thus it should be autorestar-ted in any case, otherwise there might be issue if supervisor-proc-exit-listener crashes, or in some test cases like "docker exec bmp kill -SIGKILL -1" critical processes may not work correctly in some race condition (depends on whether supervisor-proc-exit-listener is the last one to be killed) When a container receives the SIGKILL signal to terminate its processes, the order in which the processes are actually terminated can depend on the scheduling and resource availability within the container. If supervisor-proc-exit-listener is killed first before critical process, container auto restart will not be launched as expected. --- dockers/docker-sonic-bmp/supervisord.conf | 2 +- dockers/docker-sonic-gnmi/supervisord.conf | 2 +- dockers/docker-sonic-restapi/supervisord.conf | 2 +- dockers/docker-sonic-telemetry/supervisord.conf | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dockers/docker-sonic-bmp/supervisord.conf b/dockers/docker-sonic-bmp/supervisord.conf index 1e452ef78400..ed4731abc022 100644 --- a/dockers/docker-sonic-bmp/supervisord.conf +++ b/dockers/docker-sonic-bmp/supervisord.conf @@ -16,7 +16,7 @@ buffer_size=1024 command=/usr/bin/supervisor-proc-exit-listener --container-name bmp events=PROCESS_STATE_EXITED,PROCESS_STATE_RUNNING autostart=true -autorestart=false +autorestart=unexpected buffer_size=1024 [program:rsyslogd] diff --git a/dockers/docker-sonic-gnmi/supervisord.conf b/dockers/docker-sonic-gnmi/supervisord.conf index b14a99ad3738..698b0465e099 100644 --- a/dockers/docker-sonic-gnmi/supervisord.conf +++ b/dockers/docker-sonic-gnmi/supervisord.conf @@ -16,7 +16,7 @@ buffer_size=1024 command=/usr/bin/supervisor-proc-exit-listener --container-name gnmi events=PROCESS_STATE_EXITED,PROCESS_STATE_RUNNING autostart=true -autorestart=false +autorestart=unexpected buffer_size=1024 [program:rsyslogd] diff --git a/dockers/docker-sonic-restapi/supervisord.conf b/dockers/docker-sonic-restapi/supervisord.conf index b531d6cf5cad..a6b9a61b19ad 100644 --- a/dockers/docker-sonic-restapi/supervisord.conf +++ b/dockers/docker-sonic-restapi/supervisord.conf @@ -16,7 +16,7 @@ buffer_size=1024 command=/usr/bin/supervisor-proc-exit-listener --container-name restapi events=PROCESS_STATE_EXITED,PROCESS_STATE_RUNNING autostart=true -autorestart=false +autorestart=unexpected buffer_size=1024 [program:rsyslogd] diff --git a/dockers/docker-sonic-telemetry/supervisord.conf b/dockers/docker-sonic-telemetry/supervisord.conf index c0eba9ee4c2c..25f024834f3c 100644 --- a/dockers/docker-sonic-telemetry/supervisord.conf +++ b/dockers/docker-sonic-telemetry/supervisord.conf @@ -16,7 +16,7 @@ buffer_size=1024 command=/usr/bin/supervisor-proc-exit-listener --container-name telemetry events=PROCESS_STATE_EXITED,PROCESS_STATE_RUNNING autostart=true -autorestart=false +autorestart=unexpected buffer_size=1024 [program:rsyslogd]