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

[spec] Fix semantics around Abort Signal for runAdAuction() #1266

Merged
merged 5 commits into from
Sep 23, 2024

Conversation

brusshamilton
Copy link
Contributor

@brusshamilton brusshamilton commented Aug 29, 2024

@JensenPaul JensenPaul added the spec Relates to the spec label Sep 3, 2024
spec.bs Show resolved Hide resolved
spec.bs Show resolved Hide resolved
spec.bs Outdated Show resolved Hide resolved
@@ -1679,6 +1685,7 @@ and a [=real time reporting contributions map=] |realTimeContributionsMap|:
"top-level-auction", null, |topLevelOrigin|, and |realTimeContributionsMap|.
1. Decrement |pendingComponentAuctions| by 1.
1. Wait until |pendingComponentAuctions| is 0.
Copy link
Collaborator

Choose a reason for hiding this comment

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

So github doesn't seem to let me comment on the line I want, so I will do it here:

I think you need to change wait until configuration input promises resolve stuff to look for aborts, otherwise you might not terminate when you should.

Though... network fetches worry me too, like what happens if the auction is aborted and also they don't reply?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a very good point. I have modified so that wait until configuration input promises resolve fails when an abort occurs. I didn't check that Chrome has that behavior, but if not Chrome is probably wrong.

As for network fetches, I think that may be a problem, but I think it's an existing issue that affects auctions that are not aborted. I think that should wait until another CL.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's a very good point. I have modified so that wait until configuration input promises resolve fails when an abort occurs. I didn't check that Chrome has that behavior, but if not Chrome is probably wrong.

Chrome renderer will mojo to the browser the moment the abort algorithm is run, and the browser will pick it up in the event loop and abort the auction. So there is no worry about things being stuck --- but there is an inherent race there since the browser may be wrapping up the auction execution concurrently to the renderer calling abort, so the auction may still succeed.

As for network fetches, I think that may be a problem, but I think it's an existing issue that affects auctions that are not aborted. I think that should wait until another CL.

So my expectation would be that it would be fine for a non-aborted auction to wait for fetches, and that aborted ones shouldn't wait for fetches.... except in Chrome we also set a 30s timeout on fetches.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I tried to capture the possibility that the auction succeeds during an abort with this spec change. There's still some existing weirdness there I haven't handled in this CL (returning failure from a parallel queue doesn't really make sense -- probably need to fix things up and "abort these steps"), but I would prefer to fix that later.

Technically we don't need to spec things without side effects and I don't think waiting for fetches for an aborted auction would be visibly different from not waiting. I guess you could argue that the server could tell if a client disconnects before the body is sent, but does that matter. Do we need to spec whether or not to abort the fetches?

I think the timeout is something we probably should spec though.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm. Fetches are side-effects, though whether they happen or not is racey anyway? I guess we can probably just call it a quality-of-implementation type of deal --- a good implementation will cancel as much work as possible, but as the page shouldn't be able to collude with the target of fetches anyway, it shouldn't matter for correctness...

spec.bs Outdated Show resolved Hide resolved
@@ -1679,6 +1685,7 @@ and a [=real time reporting contributions map=] |realTimeContributionsMap|:
"top-level-auction", null, |topLevelOrigin|, and |realTimeContributionsMap|.
1. Decrement |pendingComponentAuctions| by 1.
1. Wait until |pendingComponentAuctions| is 0.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm. Fetches are side-effects, though whether they happen or not is racey anyway? I guess we can probably just call it a quality-of-implementation type of deal --- a good implementation will cancel as much work as possible, but as the page shouldn't be able to collude with the target of fetches anyway, it shouldn't matter for correctness...

spec.bs Outdated Show resolved Hide resolved
spec.bs Outdated Show resolved Hide resolved
@JensenPaul JensenPaul merged commit 9a4a270 into WICG:main Sep 23, 2024
2 checks passed
github-actions bot added a commit that referenced this pull request Sep 23, 2024
SHA: 9a4a270
Reason: push, by JensenPaul

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec Relates to the spec
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants