Yunbao VPN

Linux VPN resource troubleshooting

Is a Linux VPN service repeatedly OOM-killed? Check its cgroup memory events

A service exiting unexpectedly is not automatically an OOM event. systemd restart counts, kernel logs, and cgroup events help distinguish an application crash, a normal service exit, and a memory-controller kill. Save evidence and identify the cgroup version before considering limit changes.

Content updated:

First check whether the service and system recorded an OOM

  1. 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`.
  2. 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.
  3. Compare `NRestarts`, `Result`, and `ExecMainStatus` with the kernel-event time to see whether they line up.

Check systemd limits and cgroup events

  1. 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.
  2. 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.
  3. 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.

References and further reading

Back to all guides

Ready to connect?

Get the app from the official website and follow the instructions for your device.

Download ↓