next.js
192d9884 - fix: decouple backpressure in Node stream tees, disable debugChannel for node streams

Commit
69 days ago
fix: decouple backpressure in Node stream tees, disable debugChannel for node streams Replace .pipe()-based tees with manual on('data') forwarding in ReactServerResult.tee(), processNodePrelude(), and renderWithRestartOnCacheMissInDev. Node's .pipe() couples backpressure across destinations, causing deadlocks when one side buffers (e.g. flight data injection delayed by delayDataUntilFirstHtmlChunk). Temporarily disable debugChannel for all renderToFlightPipeableStream call sites. React's Node API expects debugChannel to be a Node Writable (has .write()) or WebSocket (has .send()), but Next.js passes { writable: WritableStream } (web stream). React sees debugChannel !== undefined, enables debug info production (pendingDebugChunks++), but can't find a writable destination to flush debug chunks. The flight stream never ends because pendingDebugChunks never reaches 0. A proper fix that bridges the web WritableStream to a Node Writable is coming in a follow-up commit.
Author
Committer
Parents
Loading