forked from bottlerocket-os/bottlerocket
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path9002-core-add-separate-timeout-for-system-shutdown.patch
67 lines (57 loc) · 2.6 KB
/
9002-core-add-separate-timeout-for-system-shutdown.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
From e66920d0a95a3e53b24a2f270420a85d0f2395ea Mon Sep 17 00:00:00 2001
From: Ben Cressey <bcressey@amazon.com>
Date: Tue, 10 Mar 2020 20:30:10 +0000
Subject: [PATCH] core: add separate timeout for system shutdown
There is an existing setting for this (DefaultTimeoutStopUSec), but
changing it has no effect because `reset_arguments()` is called just
before `become_shutdown()`, which sets everything back to the stock
values.
It's also awkward to use a single timeout value for stopping normal
services, and for cleaning up stray processes after most of userspace
has gone away.
Signed-off-by: Ben Cressey <bcressey@amazon.com>
Signed-off-by: Arnaldo Garcia Rincon <agarrcia@amazon.com>
---
src/basic/def.h | 3 +++
src/core/main.c | 4 +++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/basic/def.h b/src/basic/def.h
index 2b4de29..22034c7 100644
--- a/src/basic/def.h
+++ b/src/basic/def.h
@@ -18,6 +18,9 @@
* the watchdog pings will keep the loop busy. */
#define DEFAULT_EXIT_USEC (30*USEC_PER_SEC)
+/* The default time after which processes are killed on shutdown. */
+#define DEFAULT_TIMEOUT_SHUTDOWN_USEC (10*USEC_PER_SEC)
+
/* The default value for the net.unix.max_dgram_qlen sysctl */
#define DEFAULT_UNIX_MAX_DGRAM_QLEN 512UL
diff --git a/src/core/main.c b/src/core/main.c
index a84fafa..0981742 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -133,6 +133,7 @@ static ExecOutput arg_default_std_error;
static usec_t arg_default_restart_usec;
static usec_t arg_default_timeout_start_usec;
static usec_t arg_default_timeout_stop_usec;
+static usec_t arg_default_timeout_shutdown_usec;
static usec_t arg_default_timeout_abort_usec;
static usec_t arg_default_device_timeout_usec;
static bool arg_default_timeout_abort_set;
@@ -1492,7 +1493,7 @@ static int become_shutdown(
env_block = strv_copy(environ);
xsprintf(log_level, "--log-level=%d", log_get_max_level());
- xsprintf(timeout, "--timeout=%" PRI_USEC "us", arg_default_timeout_stop_usec);
+ xsprintf(timeout, "--timeout=%" PRI_USEC "us", arg_default_timeout_shutdown_usec);
switch (log_get_target()) {
@@ -2410,6 +2411,7 @@ static void reset_arguments(void) {
arg_default_restart_usec = DEFAULT_RESTART_USEC;
arg_default_timeout_start_usec = DEFAULT_TIMEOUT_USEC;
arg_default_timeout_stop_usec = DEFAULT_TIMEOUT_USEC;
+ arg_default_timeout_shutdown_usec = DEFAULT_TIMEOUT_SHUTDOWN_USEC;
arg_default_timeout_abort_usec = DEFAULT_TIMEOUT_USEC;
arg_default_timeout_abort_set = false;
arg_default_device_timeout_usec = DEFAULT_TIMEOUT_USEC;
--
2.40.1