Skip to content

Commit

Permalink
Fix hanging start-stop-daemon in footloose Alpine
Browse files Browse the repository at this point in the history
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 <[email protected]>
Link: moby/moby@8db6109
Link: https://github.com/OpenRC/openrc/blob/eb8831a1416ab2ee8123b3add78421c2aa316b39/src/start-stop-daemon/start-stop-daemon.c#L1104-L1105
(cherry picked from commit ed4e359)
(cherry picked from commit a886865)
  • Loading branch information
twz123 authored and github-actions[bot] committed Aug 31, 2023
1 parent 298bb92 commit 44c701b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion inttest/footloose-alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 44c701b

Please sign in to comment.