mirror of
https://github.com/systemd/systemd.git
synced 2024-11-24 10:43:35 +08:00
3c171f0b1e
This reworks the coredumping logic so that the coredump handler invoked from the kernel only collects runtime data about the crashed process, and then submits it for processing to a socket-activate coredump service, which extracts a stacktrace and writes the coredump to disk. This has a number of benefits: the disk IO and stack trace generation may take a substantial amount of resources, and hence should better be managed by PID 1, so that resource management applies. This patch uses RuntimeMaxSec=, Nice=, OOMScoreAdjust= and various sandboxing settings to ensure that the coredump handler doesn't take away unbounded resources from normally priorized processes. This logic is also nice since this makes sure the coredump processing and storage is delayed correctly until /var/systemd/coredump is mounted and writable. Fixes: #2286
25 lines
712 B
SYSTEMD
25 lines
712 B
SYSTEMD
# This file is part of systemd.
|
|
#
|
|
# systemd is free software; you can redistribute it and/or modify it
|
|
# under the terms of the GNU Lesser General Public License as published by
|
|
# the Free Software Foundation; either version 2.1 of the License, or
|
|
# (at your option) any later version.
|
|
|
|
[Unit]
|
|
Description=Process Core Dump
|
|
Documentation=man:systemd-coredump(8)
|
|
DefaultDependencies=no
|
|
RequiresMountsFor=/var/lib/systemd/coredump
|
|
Conflicts=shutdown.target
|
|
After=systemd-remount-fs.service systemd-journald.socket
|
|
Requires=systemd-journald.socket
|
|
Before=shutdown.target
|
|
|
|
[Service]
|
|
ExecStart=-@rootlibexecdir@/systemd-coredump
|
|
Nice=9
|
|
OOMScoreAdjust=500
|
|
PrivateNetwork=yes
|
|
ProtectSystem=full
|
|
RuntimeMaxSec=5min
|