Concurrency Errors
Solutions for race conditions, deadlocks, session interleaving, duplicate message processing, and async errors in AI agents.
28 solutions in this category
-
Agent Creates Too Many Concurrent Connections
Agent spawns unbounded parallel tool calls that exhaust connection pools, hit file descriptor limits, or overwhelm do... -
Agent Deadlocks Waiting for Tool Results
Agent hangs indefinitely when tool calls form circular dependencies, when callbacks never fire, or when async tasks a... -
Agent Doesn't Cancel In-Flight Requests When User Aborts
A user presses Stop or navigates away while the agent is mid-execution. The HTTP connection closes, but the agent's b... -
Agent Doesn't Handle Partial Failures in Parallel Tool Calls
When running multiple tool calls in parallel, one failure kills the entire batch. Successful results are discarded, t... -
Agent Drops Work Under Backpressure — Queue Overflow Loses Requests
When request volume spikes, the agent's internal queue fills up. New requests are silently dropped, or the caller get... -
Agent Holds Lock Too Long — Starves Other Workers
Agent acquires a lock to access a shared resource and holds it for 30 seconds while doing slow I/O or LLM inference. ... -
Agent Loses In-Progress Work on Graceful Shutdown — SIGTERM Kills Mid-Task
Kubernetes sends SIGTERM. Docker compose stops the container. The agent is halfway through a 50-step task. Python pro... -
Agent Mixes Up Users — Session State Shared Across Different Users
Two users send messages concurrently. Agent responds to User A with context from User B's conversation, or User A's d... -
Agent Processes Events Out of Order — Race Conditions in Async Pipelines
Two webhook events arrive milliseconds apart and the agent processes them in the wrong order. A user sends message B ... -
Agent Queue Drains — Workers Sit Idle, Then Spike When Refilled
Agent workers poll a queue at fixed intervals. Queue drains. All workers sit idle polling an empty queue every 5 seco... -
Agent Retries Already-Completed Task — Duplicate Execution
Agent sends a payment, times out waiting for confirmation, retries, and sends the payment twice. Or inserts a databas... -
Agent Scheduler Fires the Same Job Twice — Duplicate Task Execution
Scheduled agent job runs at 9:00 AM. Due to clock skew, two scheduler instances both trigger it. The job runs twice: ... -
Agent Spawns Too Many Threads — Thread Pool Exhaustion and Resource Starvation
The agent spawns a new thread per request. At 500 concurrent sessions, it creates 500 threads. Python's GIL means the... -
Agent Spawns Too Many Workers and Runs Out of Memory — OOM Kill
Agent creates one worker per task. With 10,000 tasks, it spawns 10,000 coroutines or threads. Memory exhausted, proce... -
Agent Uses Global Mutable State — Concurrent Requests Corrupt Each Other
An agent stores conversation history, user context, or tool results in module-level global variables. When two reques... -
Cowork Windows: Triple-parallel VM startup race condition causes 'VM is already running' failure loop
- [x] I have searched existing issues and this hasn't been reported -
Message Queue Consumer Crashes and Loses Message — No Dead Letter Queue
Agent consumer dequeues a message, starts processing, crashes mid-way. Message is gone — not requeued, not logged. Wo... -
Multiple Agents Write to the Same File Simultaneously — Corrupted Output
Two parallel agent workers both append to the same output file. Writes interleave at byte level. Result file contains... -
OAuth token refresh race condition kills parent session during parallel agent spawns
When spawning 3-4 parallel agents (via tool with ), the parent/lead session intermittently loses authentication mid-o... -
Race Condition in Shared Agent State — Multiple Agents Corrupting Shared Data
Two agent workers read the same counter, both increment it locally, both write back. One increment is lost. Classic r... -
RuntimeError: This event loop is already running — asyncio Loop Conflict
asyncio raises 'This event loop is already running' when trying to run async code from a synchronous context inside a... -
SQLite Database Errors with Multiple Agent Workers — Not Thread-Safe
Multiple agent workers share a SQLite database. Workers get 'database is locked', 'ProgrammingError: SQLite objects c... -
Sub-agent announce timeout — investigation report (2026-03-25)
Affected version: OpenClaw 2026.3.23-2 -
Telegram Sends Duplicate Responses — Webhook Retry Causes Double Processing
Telegram retries webhook delivery when your server is slow to respond. Agent processes the same message twice, sendin... -
Two Agents Deadlock Waiting for Each Other — Circular Dependency
Agent A waits for Agent B to complete a sub-task. Agent B is waiting for a result from Agent A. Neither proceeds. Cla... -
Two Parallel Agents Corrupt Shared File — Race Condition on Concurrent Write
Two agent tasks run in parallel and both try to write to the same file. One write overwrites the other, causing data ... -
[FEATURE] Case Study: Governing stateless sessions at scale with CLAUDE.md + MEMORY.md
When you scale Claude Code beyond prototyping — 171K lines, 96 DB tables, multiple parallel sessions over months — se... -
macOS app: Canvas overlay covers permission dialog, creating deadlock
When is invoked by the agent, the Canvas overlay renders at a higher z-order (window level) than the "Allow this comm...
Related Guide
The Concurrency Error Guide covers root causes, prevention patterns, and checklists for this category of errors.
| ← All solutions | Browse all guides |