AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Functional API Deadlock: Parent Task Blocks On Child Task While Holding Bounded Executor Slot

When a task calls another task and waits for its result, the parent worker thread blocks on Future.result() while the child task is submitted to the same bounded executor. If all executor slots are occupied by such waiting parents, the child can never start and invoke() hangs forever.

highConfidence 81%LangGraphState ManagementStateGraphConditional EdgesAffected V1.2.12Affected V1.2.14

Origin Analysis

PregelRunner._call submits child tasks to the same ThreadPoolExecutor that is running the parent. The parent's worker thread blocks synchronously in Future.result(), holding a concurrency slot that the child needs, causing a circular wait when slots are exhausted.
1. Define child and parent tasks using @task; parent returns child(x).result().\n2. Define an @entrypoint workflow that returns parent(x).result().\n3. Invoke workflow with config={\"max_concurrency\": 3}.\n4. Observe that invoke() never returns and no error is raised; thread dump shows parent blocked in Future.result() while child task never starts.

Fixing Code Block

Edge Case Audit

Running child tasks inline may reduce parallelism for parents that launch multiple independent children and then wait on them, because those children will execute sequentially inside the parent's thread. This could increase latency in fan-out workloads. If tasks rely on thread-local state or expect to run in distinct worker threads, inline execution changes that context. For a rollback, keep the original submit behaviour behind a configuration flag or use a separate unbounded executor for child tasks. Also test the async API separately; it may require an analogous asyncio-level fix to avoid deadlock in asyncio.gather scenarios.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state