Duplicated requests when network errors happen multiple time

UNCONFIRMED
Unassigned

Status

()

Core
Networking: HTTP
P3
normal
UNCONFIRMED
a year ago
10 months ago

People

(Reporter: xias1, Unassigned)

Tracking

53 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [necko-backlog])

Attachments

(2 attachments, 3 obsolete attachments)

(Reporter)

Description

a year ago
Created attachment 8863715 [details]
index.html

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36

Steps to reproduce:

Open the attached HTML page from a http server. The page only has 10 script tags that points to 10 different scripts which all have network error (404).

Let's say those script tags are 0.js, 1.js, 2.js, ..., 9.js, which all gives 404.


Actual results:

Should see 10 network errors in the dev tool, but it randomly and almost every time shows more than 10 network errors (mostly 19 errors):

> 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9

Which really should be:

> 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

Reduce it to 5 scripts from 0.js to 4.js

> 0, 1, 2, 3, 4, 1, 2, 3, 4

Reduce it to 2 scripts 0.js and 1.js

> 0, 1, 1

Once it is reduced to 1 script with network error, it no longer have duplicated requests.

> 0

---

Adding `onerror="this.parentNode.removeChild(this)"` does not prevent the duplicated requests from happening. Put a console.log into onerror hook shows that the duplicated request happens after the onerror hook.


Expected results:

It should not attempt to request the script once it fails.

I also tried Safari and Chrome. They both have a similar behavior, expect that the duplicated requests in Safari and Chrome happens more randomly.

I'm not sure if this is any kind of intended behavior since all the major browsers have the similar problem. However, even if this is intended behavior (e.g. maybe to deal with bad network condition?), a given error handler should prevent duplicated requests.
(Reporter)

Comment 1

a year ago
Created attachment 8863717 [details]
10scripts.html
(Reporter)

Comment 2

a year ago
Created attachment 8863718 [details]
screenshot of network panel in dev tool
Attachment #8863715 - Attachment is obsolete: true
(Reporter)

Comment 3

a year ago
Created attachment 8863719 [details]
index.html
Attachment #8863717 - Attachment is obsolete: true
(Reporter)

Comment 4

a year ago
Created attachment 8863720 [details]
Screen Shot 2017-05-02 at 5.37.24 AM.png
(Reporter)

Updated

a year ago
Attachment #8863718 - Attachment is obsolete: true
(Reporter)

Comment 5

a year ago
A similar chromium problem: https://bugs.chromium.org/p/chromium/issues/detail?id=717507
Component: Untriaged → Networking: HTTP
Product: Firefox → Core
Something preload/prefetch related?
Whiteboard: [necko-backlog]
You need to log in before you can comment on or make changes to this bug.