New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 726302 link

Starred by 3 users

Issue metadata

Status: WontFix
Owner:
Closed: Jul 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug



Sign in to add a comment

Fetch request keeps going after reload

Reported by zhangsan...@gmail.com, May 25 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36

Steps to reproduce the problem:
1. open the url and dev tool and see network tab
2. wait 10s, the request will come,because of the url is bad, so it will request agian.
3. type F5,reload this page, not wait 10s, but the request is sended.

What is the expected behavior?
reload page. wait 10s then request the url.

What went wrong?
look like the fetch handle the request even if reload page

Did this work before? N/A 

Chrome version: 58.0.3029.110  Channel: stable
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version:
 
the url is https://zhangsanshi.github.io/demo/creazyFetch.html.
I write wrong title.
Labels: Needs-Triage-M58

Comment 3 by junov@chromium.org, May 25 2017

Components: -Blink Blink>Scheduling
Summary: setTimeout delay is ignored after page reload. (was: https://zhangsanshi.github.io/demo/creazyFetch.html)
I was able to repro on linux.
This looks like a bug with setTimeout: the delay is ignored after reload.

Updating issue title to reflect the problem
Labels: Needs-Bisect

Comment 5 by hdodda@chromium.org, May 26 2017

Cc: hdodda@chromium.org
Labels: Needs-Feedback OS-Linux OS-Mac
Status: Untriaged (was: Unconfirmed)
Tested the issue on windows 7 , mac os 10.12.4 and ubuntu 14.04 using chrome M58 #58.0.3029.110 and chrome canary M60 #60.0.3111.0 and issue is reproduced.


During bisect , till M54 #54.0.2810.0 , issue is seen and is a bad build.
On M54 #54.0.2800.0 , when reloaded the given url , it is making the tab unresponsive and and page keeps loading for longer time..

Attached screencast for reference.

@Could someone check the attached screencast and confirm us if that is the expected behavior and if not , please provide us the expected result to traige the issue better.

Thanks!

726302.mp4
1.9 MB View Download

Comment 6 by hdodda@chromium.org, May 26 2017

Status: Unconfirmed (was: Untriaged)
I rewrite the test page and change trigger from setTimeout to click. you can test it in this page. In my pc,the tab isn't unresponsive...
https://zhangsanshi.github.io/demo/creazyFetch2.html?t=3
Project Member

Comment 8 by sheriffbot@chromium.org, May 27 2017

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "hdodda@chromium.org" to the cc list and removing "Needs-Feedback" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 9 by hdodda@chromium.org, May 29 2017

Labels: Needs-Feedback
Tested the issue on windows 7 and mac os 10.12.4 using the given new url "https://zhangsanshi.github.io/demo/creazyFetch2.html?t=3" and observed page load for longer time after reload.

Attached screencast for reference.

@Could you please check attached screencast and confirm us if this is the expected result or provide us the expected result screencast to find correct suspect.

Thanks!
723602.mp4
1.3 MB View Download
In this screencast, you can see the page isn't unresponsive and response code is 304.
If your tab is still unresponsive, maybe you can copy the code and test in your local server?
Project Member

Comment 11 by sheriffbot@chromium.org, May 31 2017

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "hdodda@chromium.org" to the cc list and removing "Needs-Feedback" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
the code is:
<button id="btn">click me</button>
<script>
  function a () {
    fetch('https://www.google.com/xxx').then(a, a);
  }
 btn.onclick = a;
</script>
Cc: ligim...@chromium.org
Tested the issue with the steps mentioned in comment #10 & 12 ,using the local server and observed the similar behavior as earlier.. after reload .. page keeps loading for longer time.

Attached screencast for reference.

Thanks!
726302.mp4
1.5 MB View Download
Cc: krajshree@chromium.org
Labels: -Needs-Triage-M58 M-61
Status: Untriaged (was: Unconfirmed)
Able to reproduce the issue on Win-10 using chrome reported version #58.0.3029.110 and latest canary #61.0.3136.0.

Following are the steps followed to reproduce the issue.
------------
1. Opened the url: https://zhangsanshi.github.io/demo/creazyFetch2.html?t=3 and dev tool and clicked network tab.
2. Waited for 10s, the request appeared.
3. Reloaded the page by typing F5.
4. Observed that request was sent immediately without waiting fro some seconds.

Note: In M-54 and M-53, on reloading the page at step-3, the page loaded for ever and became unresponsive.

Attached a screen cast of M-53 for reference.

Hence, marking it as untriaged for more inputs from dev.

Thanks...!!
726302.mp4
1.4 MB View Download
Components: Platform>DevTools>Network
Labels: -M-61 Needs-Triage-M58
More updated on this issue:

Till M-51 issue is not reproducible. Hence, it can be considered as good.
From M-52 till M-54, on reloading the page at step-3 of comment #14, the page loaded for ever and became unresponsive.
M-55 showed bad behavior.

Hence, its not feasible from TE-end to provide bisect results.

Requesting anyone from Platform>DevTools>Network team to help us in bisecting the issue and providing the bisect results.

Thanks...!!
Cc: skyos...@chromium.org
Components: -Blink>Scheduling -Platform>DevTools>Network Blink>Network>FetchAPI
Summary: Fetch request keeps going after reload (was: setTimeout delay is ignored after page reload.)
I don't think setTimeout is the problem here. Instead it looks like the fetch request is somehow kept alive after the reload. Any idea how that could be happening?
Labels: Needs-Feedback
Here's a slight variant which uses a different URL every time the page is loaded. This makes it easy to see that even after reload, it's the requests from the old page that keep going.

It's not just fetch() that is running, either. The Javascript code which starts each new fetch in response to the failure of last one has to still be running too. I didn't know that was possible.
creazyFetch3.html
189 bytes View Download
Labels: -Needs-Feedback
Here's another variant that changes the URL via the unload handler. This demonstrates that the page does know that it has been unloaded.

I've tested in Firefox and Safari. Firefox doesn't have the issue. Safari maybe does? I'm not very familiar with Safari's devtools.
creazyFetch4.html
222 bytes View Download
I've verified that it still happens when the target host is localhost using regular HTTP. So no dependency on HTTPS, HTTP/2 or QUIC, and CORS is not the cause.
Owner: yhirano@chromium.org
Status: Assigned (was: Untriaged)
Cc: yukishiino@chromium.org domenic@chromium.org
Components: Blink>Bindings
+yukishiino@, domenic@

According to yukishiino@, it is an expected behavior. Domenic, what do you think?
My understanding is as follows.

There are two windows: parent and child.
The child window is running a function |func| as follows:
  function func() {
    fetch(url).then(func, func);  // [1]
  }
  func();
The parent window makes the child window navigate to another same origin page.
However, the infinite loop of |func| doesn't stop.

Even after the navigation, the old child window's context is still alive and |func| (or fetch's promise) is still running.  Even when |fetch| failed, the failure handler of the promise |func| is invoked.  I don't know who stops this.

After the navigation, the WindowProxy points to a new window object, then [1] is equivalent to:
  new_window.fetch(url).then(func, func);
So, the fetch task is done with the new child window.  This is confusing, but this is what WindowProxy is designed for, IIUC.

The questions that people here may have seem:
a) Why the infinite loop does not stop?  Who stops it?
b) Why the fetch task runs with the new window?  Why it doesn't stick to the old window (despite that the script is written in the old window)?

I'd like to hear domenic@'s opinions / interpretations.

Cc: annevank...@gmail.com
I agree this is expected behavior. There is some spec ambiguity/bugs as to whether it should reject or fulfill, i.e. whether navigating should abort all ongoing fetches with some error or should just let them work. (See https://github.com/whatwg/fetch/issues/416 for example.) But one of the two handlers will definitely be called right now.

For a), the above describes why it keeps going infinitely, plus the fact that while navigating probably aborts fetches, once navigated, you can still fetch just fine. We could change this in the spec by not allowing fetch() calls from non-active (or non-fully-active?) documents. /cc @annevk. That is how setTimeout behaves, for example. That would break the infinite loop.

For b), your analysis about WindowProxy seems exactly right to me.
Labels: -Needs-Bisect
Removing Needs-Bisect label as this issue has been taken up by the dev team.
Please feel free to add the Needs-Bisect label if needed.

Thanks...!!
This is basically https://github.com/whatwg/html/issues/2621 as far as I can tell.
I suppose so, although that took a direction I do not favor of trying to patch promises, whereas I think the correct solution is to change fetch so that it does not even start the fetch in inactive documents. Should we use that bug to discuss such a solution, even though so far it's all about promise behavior?
We could have a different bug just for Fetch, but it's fundamentally the same problem. Using computing resources for documents that are abandoned using promises.

It also seems that even your proposal would still result in an infinite loop as the fetch() call would get rejected resulting in it being invoked again.
Status: WontFix (was: Assigned)
 Issue 781904  has been merged into this issue.

Sign in to add a comment