From 44c701bf82d7ff838e7496e68776dd91468c6320 Mon Sep 17 00:00:00 2001 From: Tom Wieczorek Date: Tue, 29 Aug 2023 14:25:40 +0200 Subject: [PATCH] Fix hanging start-stop-daemon in footloose Alpine Some distributions package Docker in a way that allows for a vast number of open file descriptors, often achieved through systemd's `LimitNOFILE=infinity` configuration. This situation leads to start- stop-daemon appearing to hang, consequently blocking the OpenRC init sequence. However, the issue is not an actual hang; rather, it attempts to close all open file descriptors, resulting in a loop with approximately one billion iterations of the close() syscall. This behavior effectively renders the footloose machine unable to boot. Mitigate this by setting the open file descriptor limit to 1 Mi in OpenRC's rc.conf. Signed-off-by: Tom Wieczorek Link: https://github.com/moby/moby/commit/8db61095a3d0bcb0733580734ba5d54bc27a614d Link: https://github.com/OpenRC/openrc/blob/eb8831a1416ab2ee8123b3add78421c2aa316b39/src/start-stop-daemon/start-stop-daemon.c#L1104-L1105 (cherry picked from commit ed4e3590608983efc0d39738fc90481bd9144a7c) (cherry picked from commit a88686522c9ee2dc367ad1158dad4e5cf282ecf4) --- inttest/footloose-alpine/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/inttest/footloose-alpine/Dockerfile b/inttest/footloose-alpine/Dockerfile index 1636d3e13801..fdf431aba4e4 100644 --- a/inttest/footloose-alpine/Dockerfile +++ b/inttest/footloose-alpine/Dockerfile @@ -18,7 +18,8 @@ RUN rc-update add local default RUN rc-update add nginx default # Ensures that /usr/local/bin/k0s is seeded from /dist at startup RUN rc-update add k0s-seed default - +# Prevent start-stop-daemon from hanging when max_fds is huge +RUN sed -Ei -e 's/^[# ](rc_ulimit)=.*/\1="-n 1048576"/' /etc/rc.conf # remove -docker keyword so we actually mount cgroups in container RUN sed -i -e '/keyword/s/-docker//' /etc/init.d/cgroups # disable ttys