First check whether the service and system recorded an OOM
- Inspect the unit and current-boot logs with `systemctl status your-vpn.service --no-pager -l` and `journalctl -b -u your-vpn.service --no-pager`.
- Review kernel messages using `journalctl -k -b --no-pager`; search for OOM, out of memory, or killed process, and note the time and process name.
- Compare `NRestarts`, `Result`, and `ExecMainStatus` with the kernel-event time to see whether they line up.
Check systemd limits and cgroup events
- Read the service’s effective memory properties: `systemctl show your-vpn.service -p ControlGroup -p MemoryCurrent -p MemoryHigh -p MemoryMax -p EffectiveMemoryMax`. Availability depends on systemd version and memory-controller support.
- On a cgroup v2 host, read `memory.events` in the directory named by `ControlGroup`. Compare `oom` and `oom_kill` counts before and after the incident rather than relying on one snapshot.
- On cgroup v1 or a host without the relevant accounting, the v2 file may not exist; absence of that file does not prove there is no memory issue.
Measure peaks before changing limits
systemd `MemoryMax=` limits a unit’s absolute memory use; if usage cannot be kept under the limit, an OOM killer may be invoked within the group. Use traffic, concurrency, buffers, and peak-time measurements to determine whether the issue is capacity, a restrictive limit, or a leak. Do not set the limit to unlimited or raise it just to hide a leak; check host memory and sibling-service headroom before changing anything.