fix(daemon): keep systemd gateway running after child OOM (#93585) · openclaw/openclaw@10113b2
snowzlm
·
2026-06-23
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -259,6 +259,7 @@ RestartSec=5
|
259 | 259 | TimeoutStopSec=30 |
260 | 260 | TimeoutStartSec=30 |
261 | 261 | SuccessExitStatus=0 143 |
| 262 | +OOMPolicy=continue |
262 | 263 | KillMode=control-group |
263 | 264 | |
264 | 265 | [Install] |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -86,6 +86,7 @@ RestartSec=5
|
86 | 86 | TimeoutStopSec=30 |
87 | 87 | TimeoutStartSec=30 |
88 | 88 | SuccessExitStatus=0 143 |
| 89 | +OOMPolicy=continue |
89 | 90 | KillMode=control-group |
90 | 91 | |
91 | 92 | [Install] |
@@ -130,6 +131,11 @@ cat /proc/<child-pid>/oom_score_adj
|
130 | 131 | Expected value for covered children is `1000`. The Gateway process should keep |
131 | 132 | its normal score, usually `0`. |
132 | 133 | |
| 134 | +The recommended systemd unit also sets `OOMPolicy=continue`. This keeps the |
| 135 | +Gateway unit alive when a transient child process is selected by the OOM killer; |
| 136 | +the child command/session can fail and report its error without systemd marking |
| 137 | +the entire gateway service failed and restarting all channels. |
| 138 | + |
133 | 139 | This does not replace normal memory tuning. If a VPS or container repeatedly |
134 | 140 | kills children, increase the memory limit, reduce concurrency, or add stronger |
135 | 141 | resource controls such as systemd `MemoryMax=` or container-level memory limits. |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -23,6 +23,7 @@ describe("buildSystemdUnit", () => {
|
23 | 23 | expect(unit).toContain("TimeoutStopSec=30"); |
24 | 24 | expect(unit).toContain("TimeoutStartSec=30"); |
25 | 25 | expect(unit).toContain("SuccessExitStatus=0 143"); |
| 26 | +expect(unit).toContain("OOMPolicy=continue"); |
26 | 27 | expect(unit).toContain("StartLimitBurst=5"); |
27 | 28 | expect(unit).toContain("StartLimitIntervalSec=60"); |
28 | 29 | expect(unit).toContain("RestartPreventExitStatus=78"); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -81,6 +81,10 @@ export function buildSystemdUnit({
|
81 | 81 | "TimeoutStopSec=30", |
82 | 82 | "TimeoutStartSec=30", |
83 | 83 | "SuccessExitStatus=0 143", |
| 84 | +// Transient child processes may be selected by the OOM killer before the |
| 85 | +// gateway. Keep the service running when that happens; the child surface is |
| 86 | +// already responsible for reporting the failed command/session. |
| 87 | +"OOMPolicy=continue", |
84 | 88 | // Keep service children in the same lifecycle so restarts do not leave |
85 | 89 | // orphan ACP/runtime workers behind. |
86 | 90 | "KillMode=control-group", |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。