Skip to content
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

Rename abortWriting()/writingAborted → reset()/remoteCanceled & abortReading()/readingAborted → cancel()/remoteReset #248

Merged
merged 11 commits into from
May 25, 2021

Conversation

jan-ivar
Copy link
Member

@jan-ivar jan-ivar commented Apr 13, 2021

Fixes #242.


Preview | Diff

Copy link
Collaborator

@aboba aboba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

abortReading() is being removed because it is considered a duplicate of cancel(reason), correct?
With readingAborted removed, is the application to know that a RST_STREAM has been received via reader.closed? Does this provide an errorCode value?

line 796/797: I don't find "drop/dropped" to be more informative than "abortWriting/writingAborted".
line 810: HTTP/2 fallback would not involve a STOP_SENDING frame. So being specific about Http3Transport would be better.
Line 828: HTTP/2 fallback would not involve a RST_STREAM frame. So being specific about Http3Transport would be better.
line 974, 990, 994, 1002: can you add the code argument?

@jan-ivar
Copy link
Member Author

@domenic do you know if the reason when calling cancel(reason) on a stream is surfaced anywhere else than in the promise it immediately returns?

@domenic
Copy link

domenic commented Apr 13, 2021

It is sent to the underlying source, which can interpret it as desired.

index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
@jan-ivar jan-ivar changed the title Rename abortWriting() to drop()/dropped + remove abortReading/readingAborted Rename abortWriting() to reset()/remoteReset + remove abortReading/readingAborted Apr 27, 2021
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
@yutakahirano
Copy link
Contributor

Reg: remoteReset, I think we can add properties to the exception with which closed is rejected, instead of introducing remoteReset. What do you think about the idea?

@jan-ivar
Copy link
Member Author

Rebased

@jan-ivar
Copy link
Member Author

Reg: remoteReset, I think we can add properties to the exception with which closed is rejected, instead of introducing remoteReset. What do you think about the idea?

Good idea! I've opened #252 on it.

In the meantime I've updated this PR to s/readingAborted/remoteReset/ as well (we can reuse the same name on readable and writable now, since we got rid of mixins).

This seems like a reasonable incremental step, so I'm hoping we can merge this PR and treat #252 as a separate idea. PTAL

index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Show resolved Hide resolved
index.bs Outdated
1. Remove [=this=] from the transport's [=[[OutgoingStreams]]=].
1. Let |reason| be |abortInfo|.errorCode.
1. If it hasn't started already, start the closing procedure by sending a
RST_STREAM frame with its error code set to the value of |reason|.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit; s/RST_STREAM/RESET_STREAM/

index.bs Outdated
|reason|.

The {{SendStream}}'s <dfn>abortAlgorithm</dfn> (TODO) is:
1. Let |stream| be the {{ReceiveStream}} object.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit; SendStream

@yutakahirano
Copy link
Contributor

Hmm, I'm confused (again).

Sending a STOP_SENDING to a ReceiveStream makes sense, sending a STOP_SENDING to a SendStream doesn't.
Isn't what you want to do removing abortWriting, not abortReading? The mapping table would be:

interface method action
ReceiveStream cancel Send STOP_SENDING with code
ReceiveStream reset Send RESET_STREAM with code
SendStream abort Send RESET_STREAM with code

OR, as commented above, we can remove reset by adding a field to the reason argument.

interface method action
ReceiveStream cancel Send STOP_SENDING or RESET_STREAM with code
SendStream abort Send RESET_STREAM with code

@jan-ivar
Copy link
Member Author

jan-ivar commented May 11, 2021

Hmm, I'm confused (again).

I think so (my fault). Sending a STOP_SENDING to a SendStream makes sense. It's the other one that was nonsense. PTAL

@jan-ivar jan-ivar changed the title Rename abortWriting() to reset()/remoteReset + remove abortReading/readingAborted Rename abortWriting()/writingAborted → reset()/remoteCanceled & abortReading/readingAborted → 🗑️ /remoteReset May 11, 2021
@jan-ivar jan-ivar changed the title Rename abortWriting()/writingAborted → reset()/remoteCanceled & abortReading/readingAborted → 🗑️ /remoteReset Rename abortWriting()/writingAborted → reset()/remoteCanceled & abortReading()/readingAborted → 🗑️ /remoteReset May 11, 2021
@jan-ivar jan-ivar changed the title Rename abortWriting()/writingAborted → reset()/remoteCanceled & abortReading()/readingAborted → 🗑️ /remoteReset Rename abortWriting()/writingAborted → reset()/remoteCanceled & abortReading()/readingAborted → cancel()/remoteReset May 11, 2021
@jan-ivar
Copy link
Member Author

With readingAborted removed, is the application to know that a RST_STREAM has been received via reader.closed? Does this provide an errorCode value?

@aboba no it doesn't. Good observation. So I've reinstated readingAborted and calling it remoteReset for now, until we can figure out the right mapping in #257. On the sender-side writingAborted is now remoteCanceled.

@jan-ivar
Copy link
Member Author

jan-ivar commented May 11, 2021

Meeting:

  • Merge PR for forward progress to not block on future nice things, but with the intent that we would eventually be able to remove these methods in favor of making abort in the streams spec work for us.
  • Update PR to use Protocol concepts
  • Error the stream on receiving STOP_SENDING to ensure producers get canceled.

@jan-ivar
Copy link
Member Author

jan-ivar commented May 12, 2021

@domenic is this the right way to error a stream?

@domenic
Copy link

domenic commented May 12, 2021

@domenic is this the right way to error a stream?

Not quite. In general you should use the algorithms from https://streams.spec.whatwg.org/#other-specs , so in this case https://streams.spec.whatwg.org/#readablestream-error and ... oops, I didn't create such a wrapper for WritableStream, let me do so right now. (It will be a wrapper around WritableStreamDefaultControllerError though, not StartErroring.

domenic added a commit to whatwg/streams that referenced this pull request May 12, 2021
domenic added a commit to whatwg/streams that referenced this pull request May 13, 2021
@jan-ivar
Copy link
Member Author

@yutakahirano does it look good now?

@jan-ivar
Copy link
Member Author

... I've reinstated readingAborted and calling it remoteReset for now, until we can figure out the right mapping in #257.

With our decision to error the stream on reception of STOP_SENDING and RESET_STREAM, the remoteCanceled and remoteReset promises seem redundant. Can we remove them?

@yutakahirano
Copy link
Contributor

Still LGTM.

Let's land this change and continue the discussion (at #260 for example).

@jan-ivar
Copy link
Member Author

Still LGTM.

Let's land this change and continue the discussion (at #260 for example).

I'll take this as a ✅ and merge this.

@jan-ivar jan-ivar merged commit a87f72a into w3c:main May 25, 2021
@jan-ivar jan-ivar deleted the drop branch May 25, 2021 18:55
github-actions bot added a commit that referenced this pull request May 25, 2021
Rename abortWriting()/writingAborted → reset()/remoteCanceled & abortReading()/readingAborted → cancel()/remoteReset

SHA: a87f72a
Reason: push, by @jan-ivar

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
yutakahirano pushed a commit to yutakahirano/streams that referenced this pull request Jun 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rename abortWriting() and remove abortReading()?
6 participants