You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
stream/web: TransformStream race can throw internal "transformAlgorithm is not a function" #62036
Darwin MacBook-Air.local 25.3.0 Darwin Kernel Version 25.3.0: Wed Jan 28 20:49:24 PST 2026; root:xnu-12377.81.4~5/RELEASE_ARM64_T8132 arm64
Subsystem
stream/web (TransformStream)
What steps will reproduce the bug?
Run:
import{TransformStream}from'node:stream/web';import{setTimeout}from'node:timers/promises';conststream=newTransformStream({transform(chunk,controller){controller.enqueue(chunk);},});// Important for reproducing this race consistently in my environment.awaitsetTimeout(500);constreader=stream.readable.getReader();constwriter=stream.writable.getWriter();// Release backpressure.constpendingRead=reader.read();// Simulate client disconnect / shutdown.constpendingCancel=reader.cancel(newError('client disconnected'));// Late write racing with cancel.constpendingLateWrite=writer.write('late-write');constresults=awaitPromise.allSettled([pendingRead,pendingCancel,pendingLateWrite,]);console.log(results);
How often does it reproduce? Is there a required condition?
Intermittent race. In my environment, adding await setTimeout(...) before acquiring reader/writer is required for reliable reproduction.
What is the expected behavior? Why is that the expected behavior?
No internal implementation TypeError should leak.
My understanding is that, when shutdown starts concurrently (cancel/abort/close paths), pending or in-flight write() operations are expected to settle coherently with stream shutdown semantics (resolve/reject according to stream state), rather than failing because an internal algorithm slot became non-callable.
What do you see instead?
pendingLateWrite can reject with an internal error:
TypeError: controller[kState].transformAlgorithm is not a function
at transformStreamDefaultControllerPerformTransform (node:internal/webstreams/transformstream:527:37)
at transformStreamDefaultSinkWriteAlgorithm (node:internal/webstreams/transformstream:573:10)
...
Activity
stream: fix TransformStream race on cancel with pending write
stream: fix TransformStream race on cancel with pending write
stream: fix TransformStream race on cancel with pending write
stream: fix TransformStream race on cancel with pending write
stream: fix TransformStream race on cancel with pending write
stream: fix TransformStream race on cancel with pending write
stream: fix TransformStream race on cancel with pending write
chore: upgrade Docker images to Node 24 (#537)
stream: fix TransformStream race on cancel with pending write
stream: fix TransformStream race on cancel with pending write
webapps/portal: require anti-affinity instead of preferred
portal, staff: bump Node runtime to 24.19.0 LTS
fix(deploy): production incident — Next.js RSC calling client fn from…
fix(runtime): pin Node 20, silence bot-POST action noise, soften auth…
fix: Node 22 -> 24 — /en'i kırıp geçici 500 üreten TransformStream ya…