Skip to content

Commit 3717fb1

Browse files
[supervisord] fix 1sec delay (#24190)
Why I did it supervisord has 1 sec delay at init. This PR partially addresses #13765 Work item tracking Microsoft ADO (number only): How I did it On init make the polling non blocking in supervisord How to verify it Boot the image, check time between supervisord start and first process start. There should be no 1 sec delay.
1 parent 6f59b56 commit 3717fb1

File tree

8 files changed

+67
-3
lines changed

8 files changed

+67
-3
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,6 @@
142142
[submodule "platform/marvell-teralynx/mrvl-teralynx"]
143143
path = platform/marvell-teralynx/mrvl-teralynx
144144
url = https://github.com/Marvell-switching/mrvl-teralynx.git
145+
[submodule "src/supervisor"]
146+
path = src/supervisor
147+
url = https://github.com/Supervisor/supervisor

dockers/docker-base-bookworm/Dockerfile.j2

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,17 @@ COPY ["pip.conf", "/etc/pip.conf"]
6060
RUN pip3 install --upgrade pip
6161
RUN apt purge -y python3-pip
6262

63+
{% if docker_base_bookworm_whls.strip() -%}
64+
# Copy locally-built Python wheel dependencies
65+
{{ copy_files("python-wheels/", docker_base_bookworm_whls.split(' '), "/python-wheels/") }}
66+
67+
# Install locally-built Python wheel dependencies
68+
{{ install_python_wheels(docker_base_bookworm_whls.split(' ')) }}
69+
{% endif %}
70+
6371
# For templating
6472
RUN pip3 install j2cli
6573

66-
# Install supervisor
67-
RUN pip3 install supervisor==4.2.5
68-
6974
# Add support for supervisord to handle startup dependencies
7075
RUN pip3 install supervisord-dependent-startup==1.4.0
7176

rules/docker-base-bookworm.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ ifeq ($(INCLUDE_FIPS), y)
1616
$(DOCKER_BASE_BOOKWORM)_DEPENDS += $(FIPS_OPENSSL_LIBSSL) $(FIPS_OPENSSL_LIBSSL_DEV) $(FIPS_OPENSSL) $(SYMCRYPT_OPENSSL) $(FIPS_KRB5)
1717
endif
1818

19+
$(DOCKER_BASE_BOOKWORM)_PYTHON_WHEELS += $(SUPERVISOR)
20+
1921
$(DOCKER_BASE_BOOKWORM)_DBG_IMAGE_PACKAGES += $(GDB) $(GDBSERVER) $(VIM) $(OPENSSH) $(SSHPASS) $(STRACE)
2022

2123
SONIC_DOCKER_IMAGES += $(DOCKER_BASE_BOOKWORM)

rules/supervisor.dep

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
SPATH := $($(SUPERVISOR)_SRC_PATH)
2+
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/supervisor.mk rules/supervisor.dep
3+
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
4+
SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files -- ':!:doc/*'))
5+
6+
$(SUPERVISOR)_CACHE_MODE := GIT_CONTENT_SHA
7+
$(SUPERVISOR)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
8+
$(SUPERVISOR)_DEP_FILES := $(DEP_FILES)
9+
$(SUPERVISOR)_SMDEP_FILES := $(SMDEP_FILES)
10+
$(SUPERVISOR)_SMDEP_PATHS := $(SPATH)

rules/supervisor.mk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# supervisor python3 wheel
2+
3+
SUPERVISOR = supervisor-4.2.5-py2.py3-none-any.whl
4+
$(SUPERVISOR)_SRC_PATH = $(SRC_PATH)/supervisor
5+
$(SUPERVISOR)_PYTHON_VERSION = 3
6+
SONIC_PYTHON_WHEELS += $(SUPERVISOR)

src/supervisor

Submodule supervisor added at 99a3e3e
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
From 87cef0051125ee068f38a17b0cab8f65f9b422e2 Mon Sep 17 00:00:00 2001
2+
From: Stepan Blyschak <[email protected]>
3+
Date: Wed, 24 Sep 2025 16:04:54 +0000
4+
Subject: [PATCH] First poll is non blocking
5+
6+
Signed-off-by: Stepan Blyschak <[email protected]>
7+
---
8+
supervisor/supervisord.py | 8 +++++++-
9+
1 file changed, 7 insertions(+), 1 deletion(-)
10+
11+
diff --git a/supervisor/supervisord.py b/supervisor/supervisord.py
12+
index 0a4f3e6..8857274 100755
13+
--- a/supervisor/supervisord.py
14+
+++ b/supervisor/supervisord.py
15+
@@ -173,11 +173,17 @@ class Supervisor:
16+
17+
def runforever(self):
18+
events.notify(events.SupervisorRunningEvent())
19+
- timeout = 1 # this cannot be fewer than the smallest TickEvent (5)
20+
+ first_poll = True
21+
22+
socket_map = self.options.get_socket_map()
23+
24+
while 1:
25+
+ if first_poll:
26+
+ timeout = 0
27+
+ first_poll = False
28+
+ else:
29+
+ timeout = 1 # this cannot not be fewer than the smallest TickEvent (5)
30+
+
31+
combined_map = {}
32+
combined_map.update(socket_map)
33+
combined_map.update(self.get_process_map())
34+
--
35+
2.39.5
36+

src/supervisor.patch/series

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0001-First-poll-is-non-blocking.patch

0 commit comments

Comments
 (0)