Werk #10070: systemd: Fixed possible memory leak related to KillMode in unit file

Komponente Checks & agents
Titel systemd: Fixed possible memory leak related to KillMode in unit file
Datum 25.09.2019
Level Kleine Änderung
Klasse Bugfix
Kompatibilität Kompatibel - benötigt kein manuelles Eingreifen
Checkmk versions & editions
2.0.0i1 Checkmk Raw (CRE), Checkmk Enterprise (CEE), Checkmk MSP (CME)
1.6.0p5 Checkmk Raw (CRE), Checkmk Enterprise (CEE), Checkmk MSP (CME)

We have seen cases in which the parameter "KillMode=process" of the unit file "check_mk@.service" causes a memory leak. This was first seen on Debian Buster but could occur in the future on other operating systems too.

The cached check runs that are forked in the backround seem to cause systemd not to discard the service once it's done. If you run:

root@linux:~# systemd-cgls -au system-check_mk.slice

you can see a lot of old services and task_struct objects in slab growing constantly. You can see those processes also on eg. Debian Stretch but there they should have no effect on task_struct objects.

To fix this, the parameter "KillMode=process" was changed to "Type=forking".

To change the unit file:

root@linux:~# systemctl stop check_mk.socket
root@linux:~# systemctl disable check_mk.socket

Copy the new check_mk@.service unit file to /etc/systemd/system/. You can download the file within "Monitoring Agents" - "Agent files" or find it in site user context ~/share/check_mk/agents/cfg_examples/systemd/.

root@linux:~# systemctl daemon-reload
root@linux:~# systemctl enable check_mk.socket
root@linux:~# systemctl start check_mk.socket

Zur Liste aller Werks