From 23721fc620b9c54a6adcea531891198b00f914f2 Mon Sep 17 00:00:00 2001 From: whatdoineed2do/Ray Date: Fri, 22 Feb 2019 17:56:12 +0000 Subject: [PATCH] [systemd] add MemoryMax to enforce mem upper limit to enable after re-installing on existing system: systemctl daemon-reload && \ systemctl restart forked-daapd --- forked-daapd.service.in | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/forked-daapd.service.in b/forked-daapd.service.in index 805cfc57..955b8c11 100644 --- a/forked-daapd.service.in +++ b/forked-daapd.service.in @@ -6,6 +6,21 @@ After=network.target sound.target remote-fs.target pulseaudio.service avahi-daem [Service] ExecStart=@sbindir@/forked-daapd -f +# Constrain the upper limit of memory/swap that can be used; this prevents +# forked-daapd from consuming all system memory (in event of bug/malformed user +# curl/SMARTPL query etc) that would hang/freeze low resource and headless (ie +# RPi) machines +# +# systemd will kill the process in such an event but would be auto-restarted as +# per 'Restart' directive below +# +# Values derived from obersvations on rpi3 under load - limits are >50% above +# seen high watermarks +# +# https://www.freedesktop.org/software/systemd/man/systemd.resource-control.html +MemoryMax=256M +MemorySwapMax=32M + # Restart, but not more than once every 10 minutes Restart=on-failure StartLimitBurst=2