X Tutup
Skip to content

Commit 2a9b932

Browse files
poetteringkeszybz
authored andcommitted
sysctl: set kernel.core_pipe_limit=16
We need to make sure that our coredump pattern handler manages to read process metadata from /proc/$PID/ before the kernel reaps the crashed process. By default the kernel will reap the process as soon as it can. By setting kernel.core_pipe_limit to a non-zero the kernel will wait for userspace to finish before reaping. We'll set the value to 16, which allows 16 crashes to be processed in parallel. This matches the MaxConnections= setting in systemd-coredump.socket. See: systemd#17301 (This doesn't close 17301, since we probably should also gracefully handle if /proc/$PID/ vanished already while our coredump handler runs, just in case people loclly set the sysctl back to zero. i.e. we should collect what we can and rather issue an incomplete log record than none.)
1 parent 4b6f74f commit 2a9b932

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

sysctl.d/50-coredump.conf.in

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@
1515
# See systemd-coredump(8) and core(5).
1616
kernel.core_pattern=|@rootlibexecdir@/systemd-coredump %P %u %g %s %t %c %h
1717

18+
# Allow that 16 coredumps are dispatched in parallel by the kernel. We want to
19+
# be able to collect process metadata from /proc/%P/ while processing
20+
# coredumps, and thus need to make sure the crashed processes are not reaped
21+
# until we finished collecting what we need. The kernel default for this sysctl
22+
# is "0" which means the kernel doesn't wait for userspace processes to finish
23+
# processing before reaping the crashed processes — by setting this higher the
24+
# kernel will delay reaping until we are done, but only for the specified
25+
# number of crashes in parallel. The value of 16 is chosen to match
26+
# systemd-coredump.socket's MaxConnections= value.
27+
kernel.core_pipe_limit=16
28+
1829
# Also dump processes executing a set-user-ID/set-group-ID program that is
1930
# owned by a user/group other than the real user/group ID of the process, or
2031
# a program that has file capabilities. ("2" is called "suidsafe" in core(5)).

0 commit comments

Comments
 (0)
X Tutup