mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 05:11:36 +00:00
fix: release gateway lock before spawning restart child
Move lock.release() before restartGatewayProcessWithFreshPid() so the spawned child can immediately acquire the lock without racing against a zombie parent. This eliminates the root cause of the restart loop where the child times out waiting for a lock held by its now-dead parent. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -83,6 +83,8 @@ export async function runGatewayLoop(params: {
|
|||||||
clearTimeout(forceExitTimer);
|
clearTimeout(forceExitTimer);
|
||||||
server = null;
|
server = null;
|
||||||
if (isRestart) {
|
if (isRestart) {
|
||||||
|
// Release the lock BEFORE spawning so the child can acquire it immediately.
|
||||||
|
await lock?.release();
|
||||||
const respawn = restartGatewayProcessWithFreshPid();
|
const respawn = restartGatewayProcessWithFreshPid();
|
||||||
if (respawn.mode === "spawned" || respawn.mode === "supervised") {
|
if (respawn.mode === "spawned" || respawn.mode === "supervised") {
|
||||||
const modeLabel =
|
const modeLabel =
|
||||||
@@ -90,7 +92,6 @@ export async function runGatewayLoop(params: {
|
|||||||
? `spawned pid ${respawn.pid ?? "unknown"}`
|
? `spawned pid ${respawn.pid ?? "unknown"}`
|
||||||
: "supervisor restart";
|
: "supervisor restart";
|
||||||
gatewayLog.info(`restart mode: full process restart (${modeLabel})`);
|
gatewayLog.info(`restart mode: full process restart (${modeLabel})`);
|
||||||
await lock?.release();
|
|
||||||
cleanupSignals();
|
cleanupSignals();
|
||||||
params.runtime.exit(0);
|
params.runtime.exit(0);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user