Skip to content

Commit 81763fa

Browse files
Decrease the wait time before SIGKILL (#183)
Docker daemon (dockerd) typically sends a SIGTERM signal after 10 seconds. Previously, we waited 20 seconds before sending a SIGKILL, but systemd would sometimes reach its timeout and forcefully terminate the process before then approximately at 14-15 seconds. To prevent this issue I have decreased the wait time to 13 seconds before sending SIGKILL. SIGTERM sometimes stops the process gracefully but it’s not always reliable so making this change is necessary. Co-authored-by: Deepika Shanmugam <92788697+deepikas20@users.noreply.github.com>
1 parent db9f512 commit 81763fa

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

app/dockerdwrapperwithcompose.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -652,8 +652,10 @@ static bool send_signal(const char* name, GPid pid, int sig) {
652652
// pointer to a counter starting at 1. When dockerd has terminated, the counter will be set to zero.
653653
// Otherwise, it will be increased, and SIGTERM will be sent on the 20th call.
654654
static gboolean monitor_dockerd_termination(void* time_since_sigterm_void_ptr) {
655-
// dockerd usually sends SIGTERM to containers after 10 s, so we must wait a bit longer.
656-
const int time_to_wait_before_sigkill = 20;
655+
// dockerd usually sends SIGTERM to containers after 10 seconds and systemd forcefully shutdown
656+
// the process approximately at 14-15 seconds, so we must wait slightly longer than 10 seconds
657+
// but not more than 15 seconds.
658+
const int time_to_wait_before_sigkill = 13;
657659
int* time_since_sigterm = (int*)time_since_sigterm_void_ptr;
658660
if (!rootlesskit_pid) {
659661
log_debug("rootlesskit exited after %d s", *time_since_sigterm);

0 commit comments

Comments
 (0)