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

Next/Image: Cancelled Image Request Hangs That Image Until Server Restart

A cancelled request to /_next/image leaves a stale in-flight promise in the image optimization cache, causing subsequent requests for the same image URL to hang indefinitely until server restart.

highConfidence 73%Next.jsReact Server ComponentsRoute HandlersHydrationAffected V15.5.xAffected V15.5.25Fixed V16.4.0-Canary.48

Origin Analysis

The image optimization endpoint uses a per-URL cache to deduplicate concurrent image processing. When a client cancels the request before completion, the abort signal is not properly handled: the cached promise is neither rejected nor removed, so later requests for the same URL await an unresolved promise, causing a permanent hang for that image.
1. Install next@15.5.25. 2. Build and start the app with a local image served via next/image. 3. Request the image through /_next/image and immediately cancel the request (e.g., close browser tab or abort fetch). 4. Request the same image URL again. 5. Observe that the second request hangs indefinitely; only a server restart clears the stuck state.

Fixing Code Block

Edge Case Audit

This patch assumes the optimizeImage function supports an AbortSignal; if it ignores the signal, the underlying I/O may not be cancelled and the promise could still hang. Validate on Node 18/20/24 and Windows. Backport to 15.5.x may require adapting to the existing AbortSignal API; test concurrent cancellations and multiple image URLs. Rollback: remove the patch and restart the server; the original bug will return.

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