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

Enforce limit on inflight keepalive bytes #419

Merged
merged 4 commits into from
Feb 25, 2017
Merged

Conversation

igrigorik
Copy link
Member

@igrigorik igrigorik commented Nov 23, 2016

Requests with keepalive flag set are allowed to outlive the environment
settings object. We want to make sure that such requests do not
negatively impact the user experience when a page is unloaded, etc.

This limits the amount of (body) bytes that can be inflight at any point
when the request has the keepalive flag set; this flag is set by
sendBeacon.

Background: w3c/beacon#39


Preview | Diff

fetch.bs Outdated
@@ -3122,10 +3122,17 @@ steps:

<li>
<p>If <var>contentLengthValue</var> is non-null, <var>httpRequest</var>'s
<a>keepalive flag</a> is set, and <var>contentLengthValue</var> is greater than a
user-agent-defined maximum, then return a <a>network error</a>.
<a>keepalive flag</a> is set:
Copy link
Member

Choose a reason for hiding this comment

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

s/,/ and/

fetch.bs Outdated
<ul>
<li>Let <var>group</var> be <var>httpRequest</var>'s <a>client</a>'s <a>fetch group</a>.
<li>Let <var>inflight keepalive bytes</var> be the sum of <a>request</a> <a>body</a>'s
<a>total bytes</a> for each <a>record</a> in <var>group</var> whose <a>done flag</a> is unset.
Copy link
Member

Choose a reason for hiding this comment

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

I get what you're trying to say, but this sentence does not read well. Maybe "sum of each X's Y in Z"?

I also think this is lacking some for="" attributes since the request you're talking about here is that of the fetch group, as is the record.

fetch.bs Outdated
<li>Let <var>inflight keepalive bytes</var> be the sum of <a>request</a> <a>body</a>'s
<a>total bytes</a> for each <a>record</a> in <var>group</var> whose <a>done flag</a> is unset.
<li>If the sum of <var>contentLengthValue</var> and <var>inflight keepalive bytes</var> is
greater than 64KB, then return a <a>network error</a>.
Copy link
Member

Choose a reason for hiding this comment

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

KiB, presumably? I wonder if we should use <abbr> for the occasion.

@igrigorik
Copy link
Member Author

@annevk ack, updated. I've split up the sum step.. hopefully that makes it more clear.

@annevk
Copy link
Member

annevk commented Nov 29, 2016

You need to use <ol> instead of <ul> and generally things are indented with only a single space and <li> are separated by a newline (though not from the opening <ol> and closing </ol>).

I also think some steps can be grouped together again, but I'm happy to make that change later on.

Is there someone else that can review this? And do we have tests for this somewhere?

@igrigorik
Copy link
Member Author

@tyoshino could you please take a look?

@annevk please feel free to wordsmith as needed.

@tyoshino
Copy link
Member

looks good

@annevk
Copy link
Member

annevk commented Nov 30, 2016

To be clear, still need an update on the testing scenario.

@igrigorik
Copy link
Member Author

@annevk sorry, forgot about that. Are you looking for web-platform tests? No one has implemented this yet, so no, we don't have those.. yet. We (Chrome) are looking to implement this (and associated sendBeacon changes) in short order, so that should be resolved fairly soon.

@igrigorik
Copy link
Member Author

bump

@annevk anything else I can help unblock on this one?

@annevk
Copy link
Member

annevk commented Jan 12, 2017

I'm sorry. I totally forgot about this. Yeah I am looking for web-platform-tests. If they are being written as part of the implementation I suppose that might be sufficient, though not ideal. Perhaps a simple test can be added?

We have a new policy where each standard PR also has a WPT PR and then the former lands after the latter.

@annevk annevk added the needs tests Moving the issue forward requires someone to write tests label Jan 17, 2017
@igrigorik
Copy link
Member Author

@annevk PTAL: web-platform-tests/wpt#4788

@annevk
Copy link
Member

annevk commented Feb 13, 2017

Thanks, I'll rebase this PR meanwhile. Tests can probably land pretty quickly if nobody else has feedback and my minor nits are fixed.

@annevk
Copy link
Member

annevk commented Feb 13, 2017

Hmm, I'm not sure how to rebase this since you added the commits on master.

@annevk
Copy link
Member

annevk commented Feb 16, 2017

The tests moved to web-platform-tests/wpt#4878. @igrigorik I'm still blocked on you sorting out how to rebase this.

@annevk annevk removed the needs tests Moving the issue forward requires someone to write tests label Feb 16, 2017
Requests with keepalive flag set are allowed to outlive the environment
settings object. We want to make sure that such requests do not
negatively impact the user experience when a page is unloaded, etc.

This limits the amount of (body) bytes that can be inflight at any point
when the request has the keepalive flag set; this flag is set by
sendBeacon.

Background: w3c/beacon#39
- split sum step into a for loop
- added group definition
- use KiB
@igrigorik
Copy link
Member Author

@annevk apologies about the delay. Updated.. ptal.

@annevk
Copy link
Member

annevk commented Feb 24, 2017

I made some formatting changes. Please review. Also note that we're currently blocked on speced/bikeshed#936.

@igrigorik
Copy link
Member Author

@annevk lgtm, good to merge once Bikeshed issue is resolved.

@annevk
Copy link
Member

annevk commented Feb 24, 2017

@igrigorik also, it's fine filing bugs now we have an agreed upon standard change and tests. Can you do that? Just file a bug against everyone that hasn't implemented this with a pointer to this PR and the tests.

@igrigorik
Copy link
Member Author

igrigorik commented Feb 24, 2017

@annevk
Copy link
Member

annevk commented Feb 25, 2017

We also need one for WebKit, right?

@igrigorik
Copy link
Member Author

@annevk indeed. Opened & updated the list above.

@annevk
Copy link
Member

annevk commented Feb 25, 2017

I'd also appreciate one more final review since I had to make a couple more changes for Bikeshed.

@igrigorik
Copy link
Member Author

Took another scrub.. LGTM.

annevk pushed a commit to web-platform-tests/wpt that referenced this pull request Feb 25, 2017
Initial set of quota tests for keepalive fetch requests. See whatwg/fetch#419 for details.
@annevk annevk merged commit 3b4cb54 into whatwg:master Feb 25, 2017
@annevk
Copy link
Member

annevk commented Feb 25, 2017

Great, thanks for reporting the bugs!

@mnot
Copy link
Member

mnot commented Feb 27, 2017

I don't suppose a different name for this could be used? Calling it "keepalive" is going to be confusing for some HTTP people...

@annevk
Copy link
Member

annevk commented Feb 27, 2017

I don't think any code has shipped thus far, though Edge has implemented. So if we have a better name we could rename, but we'd have to be quick I think and @igrigorik should confirm.

@igrigorik
Copy link
Member Author

@mnot it's request level keepalive... which—I think—is a good semantic fit with what we're trying to communicate here. I don't think we have have to monopolize keepalive for connection level semantics; most developers will never touch connection keepalive.

@mnot
Copy link
Member

mnot commented Feb 27, 2017

most developers will never touch connection keepalive

That's a surprising assertion, but OK...

@mnot
Copy link
Member

mnot commented Feb 28, 2017

One more possibly stupid question - why is this in HTTP-network-or-cache fetch and not HTTP-network fetch?

@annevk
Copy link
Member

annevk commented Feb 28, 2017

No stupid questions. I don't think there's an observable difference and I suspect @igrigorik did it this way because the former already had a handle on the body size.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants