-
Notifications
You must be signed in to change notification settings - Fork 290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clear WritableStreamSink queue on abort with compat flag #2467
Merged
Conversation
This file contains 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
@anonrig ... just fyi on this PR. This is a good simple example of the introduction of a compat flag to preserve backwards compat behavior... just for illustration. |
kentonv
reviewed
Aug 1, 2024
anonrig
approved these changes
Aug 6, 2024
kentonv
reviewed
Aug 9, 2024
Sorry for delay, I had started reviewing this a few days ago and then got distracted away. |
jasnell
force-pushed
the
jsnell/internal-streams-abort-queue
branch
from
August 9, 2024 19:27
3bb757d
to
58fc961
Compare
kentonv
approved these changes
Aug 9, 2024
jasnell
force-pushed
the
jsnell/internal-streams-abort-queue
branch
from
August 9, 2024 21:35
8165500
to
fe09ba6
Compare
jasnell
force-pushed
the
jsnell/internal-streams-abort-queue
branch
from
August 9, 2024 21:40
fe09ba6
to
346fe52
Compare
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 motivation here is to address an issue with
WritableStream
instances wrapping aWritableStreamSink
implementation not processingabort()
calls proactively. Without the flag theabort()
will be handled lazily, meaning that a consumer must be actively consuming the data written to the stream in order to trigger the abort and close the stream. This is problematic if the consumer has dropped or otherwise stopped reading from the writable's internal buffer ... the pending abort will never be processed and resolved. This means that pending writes and the pending abort itself will never be resolved in those cases. With the flag, the queue of pending writes is drained immediately whenabort()
is called and the stream is transitioned to an error state immediately. This should cause the underlyingWritableStreamSink
to be aborted and dropped immediately and the pending write and abort promises should all get settled.internal ticket: EW-8607