diff options
| author | Adam Malczewski <[email protected]> | 2026-06-28 00:56:50 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-28 00:56:50 +0900 |
| commit | d1de9ed854addd9cf626af27b41f93f2b59f04ac (patch) | |
| tree | 1b16e43291f8358ccddb02d1635164b45c58f162 | |
| parent | b83aa8ddbb7023ae9dd0332b4989d4baa11522af (diff) | |
| download | dispatch-d1de9ed854addd9cf626af27b41f93f2b59f04ac.tar.gz dispatch-d1de9ed854addd9cf626af27b41f93f2b59f04ac.zip | |
fix(systemd): add MemoryMax=24G circuit breaker to prevent segfault crashes
The server has a memory leak (~2.5 GB/h) that eventually triggers a Bun
runtime segfault. These cgroup limits turn the uncontrolled crash into a
controlled OOM-kill → clean restart via Restart=on-failure.
MemoryHigh=20G (soft throttle) + MemoryMax=24G (hard cap).
Machine has 33.24 GB total; 24G leaves OS headroom.
| -rwxr-xr-x | bin/install | 2 | ||||
| -rw-r--r-- | systemd/dispatch.service | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/bin/install b/bin/install index 4899939..3e2a62f 100755 --- a/bin/install +++ b/bin/install @@ -104,6 +104,8 @@ EnvironmentFile=/etc/dispatch/env WorkingDirectory=/var/lib/dispatch Restart=on-failure RestartSec=5 +MemoryHigh=20G +MemoryMax=24G StandardOutput=journal StandardError=journal diff --git a/systemd/dispatch.service b/systemd/dispatch.service index e651fa7..42b5a29 100644 --- a/systemd/dispatch.service +++ b/systemd/dispatch.service @@ -10,6 +10,12 @@ EnvironmentFile=/etc/dispatch/env WorkingDirectory=/var/lib/dispatch Restart=on-failure RestartSec=5 +# Memory-pressure circuit breaker: the server has a memory leak (~2.5 GB/h) +# that eventually triggers a Bun runtime segfault. These cgroup limits turn +# the uncontrolled crash into a controlled OOM-kill → clean restart. +# Machine has 33.24 GB total; 24G hard cap leaves OS headroom. +MemoryHigh=20G +MemoryMax=24G StandardOutput=journal StandardError=journal |
