Skip to content

[Bug]: Orphaned .jsonl.lock files cause "request ended without getting any chunks" and stuck sessions #10170

@zenchantlive

Description

@zenchantlive

Bug Report

Version: OpenClaw 2026.2.4 (installed from npm global)
OS: Linux 6.14.0-37-generic (x64), Node v22.22.0
Installation: npm global install

Summary

Sessions become permanently stuck with error "request ended without getting any chunks" regardless of:

  • Model provider used (tested with Anthropic, OpenAI, Groq)
  • Streaming/reasoning settings (fails with both on and off)
  • Session type (affects specific sessions, not all)

Root Cause: Orphaned .jsonl.lock files prevent OpenClaw from accessing/modifying those session files.

Steps to Reproduce

  1. Use OpenClaw gateway normally for multiple sessions
  2. Some sessions eventually get stuck with the error
  3. The error persists across model/provider changes
  4. /new does not fix it (same error on new message)

Expected Behavior

Sessions should continue working indefinitely. Lock files should be cleaned up automatically if:

  • Write completes successfully
  • Process crashes (lock should be removed on restart)
  • Timeout occurs (lock should be released)

Actual Behavior

Orphaned .jsonl.lock files remain indefinitely, blocking access to session data.

Diagnostic Output:

=== Lock files with ages ===
-rw-rw-r-- 1 clawdbot clawdbot 61 Feb  5 22:15 /home/clawdbot/.openclaw/agents/main/sessions/080faee2-12ff-4000-a22e-f85fef08c295-topic-1770325142.671159.jsonl.lock
-rw-rw-r-- 1 clawdbot clawdbot 62 Jan 31 11:25 /home/clawdbot/.openclaw/agents/main/sessions/15a892f6-d7ef-409c-a94e-62e7bba21247-topic-1769886921.313589.jsonl.lock
-rw-rw-r-- 1 clawdbot clawdbot 61 Jan 29 08:00 /home/clawdbot/.openclaw/agents/main/sessions/cc2d05b2-3b93-45cb-b696-9e1d8725702d-topic-1769669512.250939.jsonl.lock
-rw-rw-r-- 1 clawdbot clawdbot 62 Jan 31 11:07 /home/clawdbot/.openclaw/agents/main/sessions/de367d24-c65d-4982-a5a6-204925347bae-topic-1769886382.109249.jsonl.lock
-rw-rw-r-- 1 clawdbot clawdbot 61 Jan 28 22:45 /home/clawdbot/.openclaw/agents/main/sessions/f42ddc90-a372-4000-b174-8bb2fca690ec-topic-1769657840.697869.jsonl.lock

Lock files dating back 8 days - these should have been cleaned up automatically.

Workaround

Manual cleanup required:

# Remove specific stuck lock file
rm ~/.openclaw/agents/main/sessions/SESSION_ID.jsonl.lock

# Or bulk cleanup (locks older than 1 hour)
find ~/.openclaw/agents/*/sessions -name "*.lock" -mmin +60 -delete

After removing locks and restarting gateway, sessions work again.

Impact

  • Severity: High - sessions become permanently unusable
  • Workaround required: Manual file deletion + gateway restart
  • Frequency: Intermittent - affects specific sessions, not all

Suggested Fix

  1. Add lock cleanup on gateway startup: Remove orphaned locks (files older than X minutes) when gateway starts
  2. Use proper file locking: Implement fcntl or mkdir-based locks with automatic cleanup on process exit
  3. Add health check: Periodically scan for orphaned locks and log/cleanup them

Additional Context

  • 138 total sessions in main agent
  • 5 orphaned lock files found
  • No corresponding issue found in existing tracker
  • Error message "request ended without getting any chunks" may be misleading - appears to be lock contention, not streaming issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleMarked 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