-
Notifications
You must be signed in to change notification settings - Fork 16
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
Don't use dependent abort signals inside Subscriber
#154
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
chromium-wpt-export-bot
pushed a commit
to web-platform-tests/wpt
that referenced
this pull request
Jul 10, 2024
This CL introduces subtle timing differences in Subscriber abortion and teardown execution, across Subscribers in a chain of Observables. These timing differences are the result of no longer using the DOM Standard's dependent AbortSignal concept for Observables that are chained together. For a full description of this change, see WICG/observable#154. Bug: 40282760 Change-Id: I4feb6f9ad67e2dd7d7a4d5ec51fdecebc4e6ae18
chromium-wpt-export-bot
pushed a commit
to web-platform-tests/wpt
that referenced
this pull request
Jul 10, 2024
This CL introduces subtle timing differences in Subscriber abortion and teardown execution, across Subscribers in a chain of Observables. These timing differences are the result of no longer using the DOM Standard's dependent AbortSignal concept for Observables that are chained together. For a full description of this change, see WICG/observable#154. Bug: 40282760 Change-Id: I4feb6f9ad67e2dd7d7a4d5ec51fdecebc4e6ae18 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5676226 Reviewed-by: Joey Arhar <[email protected]> Commit-Queue: Dominic Farolino <[email protected]> Cr-Commit-Position: refs/heads/main@{#1325506}
chromium-wpt-export-bot
pushed a commit
to web-platform-tests/wpt
that referenced
this pull request
Jul 10, 2024
This CL introduces subtle timing differences in Subscriber abortion and teardown execution, across Subscribers in a chain of Observables. These timing differences are the result of no longer using the DOM Standard's dependent AbortSignal concept for Observables that are chained together. For a full description of this change, see WICG/observable#154. Bug: 40282760 Change-Id: I4feb6f9ad67e2dd7d7a4d5ec51fdecebc4e6ae18 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5676226 Reviewed-by: Joey Arhar <[email protected]> Commit-Queue: Dominic Farolino <[email protected]> Cr-Commit-Position: refs/heads/main@{#1325506}
Ben has approved the tests, and the Chromium implementation updates for this have landed, so I'll merge the spec now. |
github-actions bot
added a commit
that referenced
this pull request
Jul 13, 2024
SHA: f954c91 Reason: push, by domfarolino Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
moz-v2v-gh
pushed a commit
to mozilla/gecko-dev
that referenced
this pull request
Jul 15, 2024
…r Observable Subscribers, a=testonly Automatic update from web-platform-tests DOM: Don't use dependent AbortSignals for Observable Subscribers This CL introduces subtle timing differences in Subscriber abortion and teardown execution, across Subscribers in a chain of Observables. These timing differences are the result of no longer using the DOM Standard's dependent AbortSignal concept for Observables that are chained together. For a full description of this change, see WICG/observable#154. Bug: 40282760 Change-Id: I4feb6f9ad67e2dd7d7a4d5ec51fdecebc4e6ae18 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5676226 Reviewed-by: Joey Arhar <[email protected]> Commit-Queue: Dominic Farolino <[email protected]> Cr-Commit-Position: refs/heads/main@{#1325506} -- wpt-commits: 1c736ae64328a24e9c3a0c384929a5227b1c9274 wpt-pr: 47074
ErichDonGubler
pushed a commit
to erichdongubler-mozilla/firefox
that referenced
this pull request
Jul 16, 2024
…r Observable Subscribers, a=testonly Automatic update from web-platform-tests DOM: Don't use dependent AbortSignals for Observable Subscribers This CL introduces subtle timing differences in Subscriber abortion and teardown execution, across Subscribers in a chain of Observables. These timing differences are the result of no longer using the DOM Standard's dependent AbortSignal concept for Observables that are chained together. For a full description of this change, see WICG/observable#154. Bug: 40282760 Change-Id: I4feb6f9ad67e2dd7d7a4d5ec51fdecebc4e6ae18 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5676226 Reviewed-by: Joey Arhar <[email protected]> Commit-Queue: Dominic Farolino <[email protected]> Cr-Commit-Position: refs/heads/main@{#1325506} -- wpt-commits: 1c736ae64328a24e9c3a0c384929a5227b1c9274 wpt-pr: 47074
i3roly
pushed a commit
to i3roly/firefox-dynasty
that referenced
this pull request
Jul 18, 2024
…r Observable Subscribers, a=testonly Automatic update from web-platform-tests DOM: Don't use dependent AbortSignals for Observable Subscribers This CL introduces subtle timing differences in Subscriber abortion and teardown execution, across Subscribers in a chain of Observables. These timing differences are the result of no longer using the DOM Standard's dependent AbortSignal concept for Observables that are chained together. For a full description of this change, see WICG/observable#154. Bug: 40282760 Change-Id: I4feb6f9ad67e2dd7d7a4d5ec51fdecebc4e6ae18 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5676226 Reviewed-by: Joey Arhar <[email protected]> Commit-Queue: Dominic Farolino <[email protected]> Cr-Commit-Position: refs/heads/main@{#1325506} -- wpt-commits: 1c736ae64328a24e9c3a0c384929a5227b1c9274 wpt-pr: 47074
sadym-chromium
pushed a commit
to web-platform-tests/wpt
that referenced
this pull request
Jul 18, 2024
This CL introduces subtle timing differences in Subscriber abortion and teardown execution, across Subscribers in a chain of Observables. These timing differences are the result of no longer using the DOM Standard's dependent AbortSignal concept for Observables that are chained together. For a full description of this change, see WICG/observable#154. Bug: 40282760 Change-Id: I4feb6f9ad67e2dd7d7a4d5ec51fdecebc4e6ae18 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5676226 Reviewed-by: Joey Arhar <[email protected]> Commit-Queue: Dominic Farolino <[email protected]> Cr-Commit-Position: refs/heads/main@{#1325506}
5 tasks
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.
Before this pull request, a
Subscriber
's internal signal — the one exposed bySubscriber#signal()
— was a dependent signal based on two input signals:complete or error controller
before this CL) AbortSignal.Then, whenever the internal dependent signal is aborted, we run the abort algorithm which (a) "closes" the subscription (sets
subscriber.active
to false), and (b) executes all teardowns.But (1) the use of dependent AbortSignals (i.e., making each Subscriber's signal dependent on its downstream Subscriber's signal), and (2) tying a Subscriber's teardown execution to its internal signal's abort algorithms, introduced inconsistent teardown ordering for Observables chained together. Specifically, the order of teardown execution across Observables in a chain depended on whether the Observable chain experienced producer-initiated vs. consumer-initiated
unsubscription. Example:
Upstream teardowns (
a
) should run before downstream teardowns (b
). The reason the consumer-initiated case is backwards is due to the ordering or abortion among dependent AbortSignals. Specifically, once we abort the developer passed-in AbortSignal, the first thing that runs are the abort algorithms, which runs local teardowns first. Then, DOM proceeds abort any dependent (aka upstream) signals, which then runs those upstream teardowns, before aborting even more upstream signals, and so on.To fix this, this PR introduces two small but significant changes to the underlying AbortSignal infrastructure in Observables.
The first thing this PR does is stop making a Subscriber's internal signal a dependent signal based on the developer-supplied one (if one exists). The abort timing of dependent signals led to downstream Subscribers being aborted (teardowns and all) before upstream Subscribers (in the consumer-initiated unsubscription case, that is).
Instead, now the Subscriber maintains an internal AbortController (similar to today's "complete or error controller"), and its internal signal is that controller's signal. Then, like before, if a signal is provided in SubscribeOptions, we add an abort algorithm to it to close the subscription.
The second change this PR introduces is a change to the "close" algorithm itself. In addition to just setting
active
to false, it now aborts the Subscriber's internal controller. This kicks off the aborting of any upstream Subscribers right away, since those upstream "close" algorithms run (as an abort algorithm) in response to the downstream Subscriber's signal abort. This means "close" climbs all the way to the top-most upstream Subscriber/AbortSignal right away, before running any teardowns. Only after a subscription has been "closed", and after all upstream signals have been aborted, does the current Subscriber run its teardowns.This changes the timing of things. In the consumer-initiated unsubscription case, instead of downstream signals running their teardowns and then "closing" their dependent (upstream) signals after, the first thing a downstream signal does in response to abort is "close" any upstream subscribers first.
Now imagine you have the following Observable chain:
Upon aborting
signal
you'd get the following flow:Before this PR, the timing flow was like this:
Tests are being written and landed in https://chromium-review.googlesource.com/c/chromium/src/+/5676226.
Preview | Diff