The default bug view has changed. See this FAQ.

negative pipelining feedback on failed image parses

RESOLVED FIXED in mozilla14

Status

()

Core
Networking: HTTP
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: mcmanus, Assigned: mcmanus)

Tracking

11 Branch
mozilla14
x86_64
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

9.01 KB, patch
mayhemer
: review+
Details | Diff | Splinter Review
(Assignee)

Description

5 years ago
this is a long planned item for pipelining "negative feedback". Correlated with the old pipelining failures were pages with a lot of broken images (occasionally js or css was getting fed into images) - for various reasons most of that has disappeared from the net, but its still a reasonable metric for whether pipelining is running ok - at least on the negative side.

Even if there are legit errors that means cancellations are going to happen, connections are going to close, and that's bad for pipelining too. Basically, pipelines are speculating on a future clean environment.

Consumer code that discovers a problem with data from necko can report its nsiuri through the new net:failed-to-process-uri observer event. Right now the only thing that makes that kind of report is imagelib - it seemed to me that parse errors are just too common in other kinds of resources. Right now necko just uses this as pipeline feedback, but you can imagine maybe invalidating caches feeding this information into a database as potential future uses of it.

there's even a test.
(Assignee)

Comment 1

5 years ago
Created attachment 588186 [details] [diff] [review]
patch 0
Assignee: nobody → mcmanus
Status: NEW → ASSIGNED
Attachment #588186 - Flags: review?(honzab.moz)
Attachment #588186 - Flags: review?(bzbarsky)
Comment on attachment 588186 [details] [diff] [review]
patch 0

Looks fine to me, but could use an actual imagelib peer too.
Attachment #588186 - Flags: review?(bzbarsky) → review+
(Assignee)

Comment 3

5 years ago
Comment on attachment 588186 [details] [diff] [review]
patch 0

joe, can you glance at the imagelib bit of this?
Attachment #588186 - Flags: review?(joe)
Comment on attachment 588186 [details] [diff] [review]
patch 0

Review of attachment 588186 [details] [diff] [review]:
-----------------------------------------------------------------

One thing to note is that we're only guaranteed to look at the first N bytes of an image (N changes as of bug 715308), so you cannot rely on this to guarantee that images decode correctly. That is, onerror only fires if the file is absolutely not an image, not if it is subtly corrupt.

::: image/src/imgRequest.cpp
@@ +704,5 @@
> +
> +    nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
> +    if (os)
> +      os->NotifyObservers(mURI, "net:failed-to-process-uri", nsnull);
> +  }

Please put this block above the comment block.

::: image/test/mochitest/test_net_failedtoprocess.html
@@ +30,5 @@
> +
> +  observe: function(subject, topic, data) {
> +    ok(topic == "net:failed-to-process-uri", "wrong topic");
> +    subject = subject.QueryInterface(Ci.nsIURI);
> +    ok(subject.asciiSpec == "chrome://mochitests/content/chrome/image/test/mochitest/invalid.jpg", "wong subject");

wrong, not wong

@@ +37,5 @@
> +};
> +
> +var obs = Cc["@mozilla.org/observer-service;1"].getService();
> +obs = obs.QueryInterface(Ci.nsIObserverService);
> +obs.addObserver(observer, "net:failed-to-process-uri", false);

I don't *think* this will work in a world where we need SpecialPowers to use chrome things. I'd prefer this test to be rewritten using SpecialPowers. (If this, in fact, is not just a chrome test; it's not obvious to me.)
Attachment #588186 - Flags: review?(joe) → review+
Comment on attachment 588186 [details] [diff] [review]
patch 0

Review of attachment 588186 [details] [diff] [review]:
-----------------------------------------------------------------

::: image/src/imgRequest.cpp
@@ +703,5 @@
> +    // Report the URI to net:failed-to-decode-uri observers.
> +
> +    nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
> +    if (os)
> +      os->NotifyObservers(mURI, "net:failed-to-process-uri", nsnull);

Hmmm... shouldn't this topic be more specific like:
- "net:failed-image-content-processing-on-uri"
- "net:image-content-corrupted", or at least
- "net:failed-to-process-uri-content"

This seems to me too general and could potentially collide, but up to you.

::: netwerk/protocol/http/nsHttpConnectionMgr.cpp
@@ +987,5 @@
> +    nsCAutoString host;
> +    PRInt32 port = -1;
> +    bool usingSSL = false;
> +
> +    nsresult rv = uri->SchemeIs("https", &usingSSL);

What if this is not http at all?

@@ +998,5 @@
> +
> +    nsRefPtr<nsHttpConnectionInfo> ci =
> +        new nsHttpConnectionInfo(host, port, nsnull, usingSSL);
> +    
> +    PipelineFeedbackInfo(ci, RedCorruptedContent, nsnull, 0);

Have an overload for connection entry instead of conn info?  We could have a static method to create the key from host,port,usingSSL,etc that nsHttpConnectionInfo can use and also this code can use.  Or, just find entry by nsIURI.

Creating nsHttpConnectionInfo for purpose of passing a hashing key doesn't seems right and necessary.

Both entries (anon/non-anon), if exist respectively, should get the feedback notification.
Attachment #588186 - Flags: review?(honzab.moz)
(Assignee)

Comment 6

5 years ago
Created attachment 597440 [details] [diff] [review]
patch v1
Attachment #588186 - Attachment is obsolete: true
Attachment #597440 - Flags: review?(honzab.moz)
Comment on attachment 597440 [details] [diff] [review]
patch v1

Review of attachment 597440 [details] [diff] [review]:
-----------------------------------------------------------------

r=honzab
Attachment #597440 - Flags: review?(honzab.moz) → review+
(Assignee)

Comment 8

5 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/672cc4ee2dd9
Sorry, I backed this out on inbound because something in the push appeared to cause a leak in mochitest-browser-chrome:
https://hg.mozilla.org/integration/mozilla-inbound/rev/577da08878cb
(Assignee)

Comment 10

5 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/6018a0d6b33d
https://hg.mozilla.org/mozilla-central/rev/6018a0d6b33d
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla14
You need to log in before you can comment on or make changes to this bug.