Clear WritableStreamSink queue on abort with compat flag#2467
Merged
Conversation
Collaborator
Author
|
@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
Collaborator
Author
kentonv
reviewed
Aug 9, 2024
Member
|
Sorry for delay, I had started reviewing this a few days ago and then got distracted away. |
3bb757d to
58fc961
Compare
kentonv
approved these changes
Aug 9, 2024
8165500 to
fe09ba6
Compare
fe09ba6 to
346fe52
Compare
1 task
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 motivation here is to address an issue with
WritableStreaminstances wrapping aWritableStreamSinkimplementation 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 underlyingWritableStreamSinkto be aborted and dropped immediately and the pending write and abort promises should all get settled.internal ticket: EW-8607