Skip to content

Session lock timeout causes channel handler failures during long operations #3092

@delonsp

Description

@delonsp

Description

Channel handlers (especially Telegram) frequently fail with lock timeout when the agent is processing any long operation (exec commands, HTTP requests, tool calls, etc):

error gateway/channels/telegram handler failed: Error: timeout acquiring session store lock: /root/.clawdbot/agents/main/sessions/sessions.json.lock

This happens even with a single channel active - it's not specific to multi-channel scenarios.

Steps to Reproduce

  1. Start a conversation that triggers a long operation (e.g., slow exec command, HTTP request that hangs)
  2. While processing, send another message from the same or different channel
  3. The new message fails with lock timeout

Expected Behavior

Messages should queue and process sequentially, or the lock acquisition should have a longer timeout with retries.

Actual Behavior

The channel handler fails immediately when it can't acquire the lock within the timeout period. The user sees no response and has to retry.

Environment

  • Clawdbot version: 2026.1.24-3
  • OS: Linux (Ubuntu)
  • Channels: Telegram, WhatsApp
  • Agent config: maxConcurrent: 4

Current Workaround

Cron job to clean stale locks every 2 minutes:

*/2 * * * * find /root/.clawdbot/agents/main/sessions -name "*.lock" -mmin +2 -delete

This helps recover from stuck locks but doesn't prevent the failures.

Suggestions

  1. Increase lock acquisition timeout for channel handlers
  2. Implement automatic retry with backoff
  3. Use a message queue instead of failing immediately
  4. Consider async/non-blocking lock mechanism
  5. Separate lock scopes for different operations (read vs write)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdedupe:parentPrimary canonical item in dedupe clusterstaleMarked as stale due to inactivity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions