mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-11-04 06:15:44 +08:00
fix(dind): double-fork in s6-notifyoncheck to eliminate zombie processes (#1364)
In `scripts/s6/docker/run`, `s6-notifyoncheck` runs without the `-d` flag: ```bash exec s6-notifyoncheck -n 0 dockerd-entrypoint.sh ``` Without `-d`, `s6-notifyoncheck` performs a single fork to execute the background checking process. The parent immediately replaces itself via `exec` with `dockerd-entrypoint.sh` (which calls `exec rootlesskit` on `dind-rootless`). Because only a single fork occurred, the background checking child remains parented to `rootlesskit`. When the check passes and the process terminates: 1. `rootlesskit` did not spawn this process and never reaps it via `waitpid()`. 2. Under standard Linux process semantics, `s6-svscan` (PID 1) cannot adopt or reap the child because its parent (`rootlesskit`) is still running. 3. The terminated process remains as a permanent zombie (`[s6-notifyoncheck] <defunct>`) for the container's entire lifespan. Adding `-d` instructs `s6-notifyoncheck` to double-fork, detaching the background check so it is immediately adopted by `s6-svscan` (PID 1) and cleanly reaped upon exit. --------- Co-authored-by: silverwind <2021+silverwind@noreply.gitea.com> Reviewed-on: https://gitea.com/gitea/runner/pulls/1364 Reviewed-by: silverwind <2021+silverwind@noreply.gitea.com> Co-authored-by: adamaru <232090+adamaru@noreply.gitea.com>
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
exec s6-notifyoncheck -n 0 dockerd-entrypoint.sh
|
||||
exec s6-notifyoncheck -d -n 0 dockerd-entrypoint.sh
|
||||
|
||||
Reference in New Issue
Block a user