fix: release gateway lock before process.exit in run-loop
process.exit() called from inside an async IIFE bypasses the outer try/finally block that releases the gateway lock. This leaves a stale lock file pointing to a zombie PID, preventing the spawned child or systemctl restart from acquiring the lock. Release the lock explicitly before calling exit in both the restart-spawned and stop code paths. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -90,6 +90,7 @@ export async function runGatewayLoop(params: {
|
||||
? `spawned pid ${respawn.pid ?? "unknown"}`
|
||||
: "supervisor restart";
|
||||
gatewayLog.info(`restart mode: full process restart (${modeLabel})`);
|
||||
await lock?.release();
|
||||
cleanupSignals();
|
||||
params.runtime.exit(0);
|
||||
} else {
|
||||
@@ -104,6 +105,7 @@ export async function runGatewayLoop(params: {
|
||||
restartResolver?.();
|
||||
}
|
||||
} else {
|
||||
await lock?.release();
|
||||
cleanupSignals();
|
||||
params.runtime.exit(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user