Skip to content

session file locked (timeout 10000ms) causes agent to fail before reply #31489

@ytzhiyun

Description

@ytzhiyun

Summary

We occasionally see the agent fail to respond with an error like:

session file locked (timeout 10000ms): pid=<gateway-pid> .../sessions/<session>.jsonl.lock
When this happens, all models fail because the session store can’t acquire the lock.

Environment

  • OpenClaw: 2026.2.26 (cli banner shows commit 5987afc)
  • Deployment: Docker container (1Panel)
  • Session store path: ~/.openclaw/agents/main/sessions/

Observed behavior

  • A *.jsonl.lock file exists (JSON like {"pid": 7, "createdAt": "..."}).
  • The referenced PID is still alive (openclaw-gateway).
  • Attempts to write to the session time out after 10000ms.
  • Workaround: restarting gateway/container restores service; in some cases moving/removing the *.jsonl.lock file immediately restores, but that’s risky while the process is alive.

Expected behavior

  • Session writes should not deadlock or time out due to a lock file while the gateway process is healthy.
  • If a lock can’t be acquired quickly, the system should recover (e.g., detect stale lock, or provide safer lock recovery).

Notes / Hypothesis

This looks like stale-lock or lock-release failure. It may be related to PID reuse after restart, or a lock file persisting longer than intended.

Timestamp

  • Report created: 2026-03-02 08:51 UTC

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions