3x-ui/internal/util/sys
Aleksey Fedorov efe768521d
fix(memory): derive the Go soft limit from the panel's own cgroup (#7102)
The automatic soft limit read only /sys/fs/cgroup/memory.max, the root of
the cgroup namespace. A systemd MemoryMax on x-ui.service lives below that
root, so it was never seen: on a bare host the root has no memory.max and
no soft limit was set at all, and inside an LXC/Incus container the limit
came from the container (2 GiB -> "1843 MiB") while systemd killed the
panel at 650M. Either way GC never tightened before the OOM kill.

Walk from the process's own cgroup (/proc/self/cgroup) up to the visible
root and take the tightest memory.max (cgroup v2) or
memory.limit_in_bytes (v1). Docker with a private cgroup namespace sees
the same root limit as before.
2026-11-12 23:35:08 +01:00
..
cpu_times.go fix: keep panel restarts from hanging on the CPU job and Telegram (#7029) 2026-11-02 15:34:22 +01:00
lxc_metrics.go fix(monitoring): read LXC CPU, swap and uptime from the container (#6920) 2026-10-24 20:24:34 +02:00
lxc_metrics_linux.go fix(monitoring): read LXC CPU, swap and uptime from the container (#6920) 2026-10-24 20:24:34 +02:00
lxc_metrics_linux_test.go fix(monitoring): read LXC CPU, swap and uptime from the container (#6920) 2026-10-24 20:24:34 +02:00
lxc_metrics_other.go fix(monitoring): read LXC CPU, swap and uptime from the container (#6920) 2026-10-24 20:24:34 +02:00
memlimit.go fix(memory): derive the Go soft limit from the panel's own cgroup (#7102) 2026-11-12 23:35:08 +01:00
memlimit_test.go fix(memory): derive the Go soft limit from the panel's own cgroup (#7102) 2026-11-12 23:35:08 +01:00
procmem.go perf(memory): report real RSS and cut footprint via GOGC + periodic release 2026-06-25 22:16:38 +02:00
psutil.go refactor: focused service files, leaf subpackages, and an internal/ layout (#5167) 2026-06-10 15:19:22 +02:00
sys_darwin.go refactor: focused service files, leaf subpackages, and an internal/ layout (#5167) 2026-06-10 15:19:22 +02:00
sys_linux.go fix(lint): use errors.Is for io.EOF comparison in sys_linux 2026-06-27 16:38:07 +02:00
sys_windows.go style: adopt golangci-lint v2 and resolve all findings 2026-06-27 15:42:22 +02:00