Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upIgnore aborted responses in caching #19350
Conversation
highfive
commented
Nov 23, 2017
|
Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @Manishearth (or someone else) soon. |
highfive
commented
Nov 23, 2017
|
Heads up! This PR modifies the following files:
|
109b613
to
1023897
|
|
||
| response.status = (code, phrase) | ||
|
|
||
| if request.GET.first("trickle", None): |
This comment has been minimized.
This comment has been minimized.
jdm
Nov 23, 2017
Member
If the only change necessary was adding a trickle option, we can get that automatically with the existing script: http://wptserve.readthedocs.io/en/latest/pipes.html#trickle
This comment has been minimized.
This comment has been minimized.
gterzian
Nov 24, 2017
•
Author
Member
thanks for the pointer.
I tried applying the trickle option when making the XHR call, however it appears that such 'pipes' are only applied to static files, not python scripts(and the cache logic in the script is still necessary in addition to the trickle). The docs don't mention this, however in the code it really seems that wrap_pipeline is only applied to the response of the FileHandler(and therefore not to response of the PythonScriptHandler), see https://github.com/w3c/web-platform-tests/blob/master/tools/wptserve/wptserve/handlers.py#L150.
I opened a PR to update the docs by the way, in case this is correct(it would have saved me some debugging time to have a note present) web-platform-tests/wpt#8415
1023897
to
d07508f
280268a
to
dee72e2
|
Ok, an extra commit to handle To allow the cache to construct a response that hasn't finished receiving it's body yet, the cache simply has to work with the "done channel", in a similar way to the fetch worker thread. The problem I encountered related to aborting a fetch. Consider the following example:
At this point, if we allow the cache to construct a response with a body of
To handle the problem of 6, I added a loop in I amended the test in Please let me know what you think. |
1b9530a
to
95f771f
|
I'm not clear why we need more uses of done_chan here? |
|
@Manishearth One could say it's pretty much because of the logic in wait_for_response. Here is the situation:
The somewhat hacky solution I have found so far for the problem under 4, is to have this loop receive on the done_chan set by the cache, and in the case of an aborted fetch, discard the cached response and do a network fetch after all. |
|
In the context of this PR, the easy solution is to disregard the second commit, that way we have a cache that only deals in responses that have been fully loaded, and it will simply filter out those that have been aborted. I do think the second commit highlights an interesting problem, perhaps even something that, if we get it right, could help clarify the spec. The spec makes it obvious that "Typically response’s body’s stream is still being enqueued to after returning", but doesn't quite tell us how this fits in with caching. In fact caching is mostly referred to as a fully sync process in the spec(it's not clear if the cache can return a response whose body stream is still being enqueued to from another fetch). The question of a fetch being aborted makes this even more interesting. What to do with a response from the cache, whose body is still being enqueued to from another fetch, when that other fetch is being aborted? It's easy to filter out cached responses that have been already aborted when the subsequent fetch asks for them, it's harder to deal with the "async" situation of the cached response still waiting on the body being fetched by another fetch, who then is aborted... I have a feeling that the relationship between caching, fetching, and aborting could use some additional norms. |
|
Have you had time to form thoughts on this one? Looking forward to those... Regarding the 'trickle' inside the python cache script, I've opened a PR to allow applying pipes to python scripts too. web-platform-tests/wpt#8541, so in some way this PR is blocked by that one. In the meantime, could we perhaps try a test run on this one? It's a bit too slow on my machine, and I'm wondering how the current changes fare against the full suite... |
…r=jdm Ignore aborted responses in caching <!-- Please describe your changes on the following line: --> @jdm @KiChjang @Manishearth Follow up on #18676 and #19274 to ignore aborted responses in caching. I also found out the cache shouldn't return any response whose body is still in `ResponseBody::Receiving` mode, because that fails the assertion at https://github.com/servo/servo/blob/master/components/net/fetch/methods.rs#L438(we might want to add a channel as pat of the cached response later on to deal with this case). I only found out now because I needed the response from the server to trickle in so that it could be cached and aborted. I copied the `http-cache.py` server from the wpt folder, and added a 'trickle' option, which is necessary to actually have a failing test with a cached but aborted request, it's now passing. I also remove one unused import that slippled through previously. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19350) <!-- Reviewable:end -->
|
|
|
From
|
|
@bors-servo retry |
…r=jdm Ignore aborted responses in caching <!-- Please describe your changes on the following line: --> @jdm @KiChjang @Manishearth Follow up on #18676 and #19274 to ignore aborted responses in caching. I also found out the cache shouldn't return any response whose body is still in `ResponseBody::Receiving` mode, because that fails the assertion at https://github.com/servo/servo/blob/master/components/net/fetch/methods.rs#L438(we might want to add a channel as pat of the cached response later on to deal with this case). I only found out now because I needed the response from the server to trickle in so that it could be cached and aborted. I copied the `http-cache.py` server from the wpt folder, and added a 'trickle' option, which is necessary to actually have a failing test with a cached but aborted request, it's now passing. I also remove one unused import that slippled through previously. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19350) <!-- Reviewable:end -->
|
|
|
@bors-servo retry |
…r=jdm Ignore aborted responses in caching <!-- Please describe your changes on the following line: --> @jdm @KiChjang @Manishearth Follow up on #18676 and #19274 to ignore aborted responses in caching. I also found out the cache shouldn't return any response whose body is still in `ResponseBody::Receiving` mode, because that fails the assertion at https://github.com/servo/servo/blob/master/components/net/fetch/methods.rs#L438(we might want to add a channel as pat of the cached response later on to deal with this case). I only found out now because I needed the response from the server to trickle in so that it could be cached and aborted. I copied the `http-cache.py` server from the wpt folder, and added a 'trickle' option, which is necessary to actually have a failing test with a cached but aborted request, it's now passing. I also remove one unused import that slippled through previously. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19350) <!-- Reviewable:end -->
|
|
|
thanks! I'll update the wpt code and remove the then unnecessary |
WPT tests: Remove custom cache script, use trickle option instead <!-- Please describe your changes on the following line: --> Follow up on #19350 @jdm --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19849) <!-- Reviewable:end -->
WPT tests: Remove custom cache script, use trickle option instead <!-- Please describe your changes on the following line: --> Follow up on #19350 @jdm --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19849) <!-- Reviewable:end -->
WPT tests: Remove custom cache script, use trickle option instead <!-- Please describe your changes on the following line: --> Follow up on #19350 @jdm --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19849) <!-- Reviewable:end -->
gterzian commentedNov 23, 2017
•
edited by KiChjang
jdm KiChjang Manishearth Follow up on #18676 and #19274 to ignore aborted responses in caching.
I also found out the cache shouldn't return any response whose body is still in
ResponseBody::Receivingmode, because that fails the assertion at https://github.com/servo/servo/blob/master/components/net/fetch/methods.rs#L438(we might want to add a channel as pat of the cached response later on to deal with this case). I only found out now because I needed the response from the server to trickle in so that it could be cached and aborted.I copied the
http-cache.pyserver from the wpt folder, and added a 'trickle' option, which is necessary to actually have a failing test with a cached but aborted request, it's now passing.I also remove one unused import that slippled through previously.
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is