openclaw-lighthouse

Multi-instance session lock timeout: clear stale locks and restart gateways

Problem

In multi-instance OpenClaw Docker setups, some gateways become slow or stop replying. Logs show:

session file locked (timeout 10000ms)

Users experience delayed responses or no response.

Why this happens

OpenClaw session files use lock files (*.jsonl.lock) to prevent concurrent writes. After interrupted or overlapping local runs, stale locks can remain and block new turns.

When this happens, model fallback does not recover, because all models for that turn are blocked by the same session lock.

Step-by-step fix

1) Identify affected instances

Check which gateways are running and which ones are slow.

docker ps --format '\t' | grep 'openclaw-openclaw-gateway-' | sort -V

2) Remove stale lock files for affected instances

Use host-side mapped paths (recommended in Docker multi-instance setups).

for i in 7 8 9 10 11; do
  lockdir="/opt/openclaw-multi/data/oc${i}/config/agents/main/sessions"
  [ -d "$lockdir" ] || continue
  find "$lockdir" -name '*.jsonl.lock' -print -delete
done

If your instance range is different, replace 7 8 9 10 11 with your actual IDs.

3) Restart only affected gateway groups

Restart containers so in-memory state is also reset.

cd /opt/openclaw-multi/openclaw

docker compose --env-file .env.multi.oc7-9 -f docker-compose.oc7-9.yml restart
docker compose --env-file .env.multi.oc10-11 -f docker-compose.oc10-11.yml restart

4) Re-test responsiveness

Run one low-cost local ping per gateway.

for i in 7 8 9 10 11; do
  name="openclaw-openclaw-gateway-${i}-1"
  docker exec "$name" openclaw agent --local --agent main \
    --message "Reply exactly SPEED_OK" --thinking low --json
  echo
done

Optional checks if it still fails

  1. Check gateway/channel health:
docker exec openclaw-openclaw-gateway-7-1 openclaw channels status --probe
  1. Check for newly re-created lock files:
find /opt/openclaw-multi/data/oc7/config/agents/main/sessions -name '*.jsonl.lock' -print
  1. Avoid tight parallel test loops against the same session.

Validation

Security notes

Upstream status

References

Credits