Skip to content

Session write lock leaked on embedded abort settle timeout #91327

Description

@immortal-autumn

Version

OpenClaw 2026.6.1

Summary

When chat.abort is triggered during a long-running model call, the embedded run's abort settle can time out (embedded abort settle timed out, 2000ms). The gateway acquires a session write lock during cleanup, but the lock is never released on the timeout path, blocking all subsequent messages to that session.

Trigger

  1. Agent is executing a long-running model call
  2. User triggers chat.abort
  3. embedded abort settle timed out after timeoutMs=2000

Observed behavior

  • Gateway process (not agent worker) holds session JSONL write lock
  • Lock maxHoldMs is 1,020,000ms (17 minutes)
  • All subsequent agent replies time out at 60s waiting for the lock
  • Error: SessionWriteLockTimeoutError: session file locked ... pid=<gateway-pid> alive=true
  • Lock is only released when gateway process exits (restart) or after 17 min expiry

Log timeline (UTC)

04:35:52 chat.abort ✓ 87ms
04:35:55 embedded abort settle timed out: runId=ba228388… sessionId=e3307808… timeoutMs=2000
04:35:55 lock file created: pid=<gateway> maxHoldMs=1020000
04:37:14 SessionWriteLockTimeoutError ageMs=79210  (×2 lanes)
04:38:25 SessionWriteLockTimeoutError ageMs=149601 (×2 lanes)

Impact

Complete session blockage — all user messages during the 17-minute lock window return errors instead of actual replies.

Suspected root cause

The abort cleanup path acquires a session write lock but the finally/cleanup only releases it on the success path. When abort settle timed out, the lock is not released.

Workaround

Restart gateway (openclaw gateway restart), but this drops all active connections.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions