Conversation
Contributor
|
LGTM |
The transform sink's write algorithm waited for the backpressure-change promise in a loop, re-checking the flag after each wake-up. The spec waits once: a read's pull releases the write, and an enqueue on a stored controller in that same turn re-asserts backpressure before the write's reaction runs, yet the write still transforms. Under the loop it parked again until the next read, so a producer that awaited each write before reading again deadlocked, and the transformer never saw the chunk. The C++ implementation waits once. Both sink writes now wait once and then check the writable for erroring, as before. The zero-algorithm path's loop could never iterate twice, since that readable has no controller to enqueue through; it changes for uniformity. Pinned in the transform suite's backpressure.js. The release through a pending read is parity. The release through a dequeue at readable hwm 1 is a divergence (ledger #14): the C++ readable does not pull after a dequeue that leaves room (readable ledger #5), so its write stays parked until a read finds the queue empty. An error() in the release's turn is a divergence too (ledger #15): the woken TypeScript write rejects with the writable's stored error, the C++ one has already lost its writable reference and algorithms and rejects with the identity path's enqueue TypeError.
jasnell
force-pushed
the
jasnell/ts-streams-transform-write-stall
branch
from
September 17, 2026 16:29
1ec78d5 to
ae8979d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The transform sink's write algorithm waited for the backpressure-change
promise in a loop, re-checking the flag after each wake-up. The spec
waits once: a read's pull releases the write, and an enqueue on a stored
controller in that same turn re-asserts backpressure before the write's
reaction runs, yet the write still transforms. Under the loop it parked
again until the next read, so a producer that awaited each write before
reading again deadlocked, and the transformer never saw the chunk. The
C++ implementation waits once.
Both sink writes now wait once and then check the writable for
erroring, as before. The zero-algorithm path's loop could never iterate
twice, since that readable has no controller to enqueue through; it
changes for uniformity.
Pinned in the transform suite's backpressure.js. The release through a
pending read is parity. The release through a dequeue at readable hwm 1
is a divergence (ledger #14): the C++ readable does not pull after a
dequeue that leaves room (readable ledger #5), so its write stays parked
until a read finds the queue empty. An error() in the release's turn is
a divergence too (ledger #15): the woken TypeScript write rejects with
the writable's stored error, the C++ one has already lost its writable
reference and algorithms and rejects with the identity path's enqueue
TypeError.