Closed
Bug 1125490
Opened 10 years ago
Closed 10 years ago
Request discarding when untracking images from a document in PresShell:Destroy
Categories
(Core :: Layout: Images, Video, and HTML Frames, defect)
Core
Layout: Images, Video, and HTML Frames
Tracking
()
RESOLVED
FIXED
mozilla38
People
(Reporter: seth, Assigned: seth)
References
Details
Attachments
(2 files, 2 obsolete files)
(deleted),
patch
|
tnikkel
:
review+
lmandel
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
lmandel
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
I've found multiple ways we could fix bug 1122704; so far the focus has been on changes we could make in ImageLib. After more investigation, though, I think the issue in bug 1122704 goes deeper. An (edited) IRC log:
[18:10:28] seth: tn: not sure if you saw the discussion in #memshrink, but i put together a quick hack that tests bug 1123976, and i think it's going to be a win
[18:12:50] seth: tn: i'm a bit puzzled as to *why* we do better, though, because it looks like we call RequestDiscard on a document's images when the document gets destroyed
...
[18:44:13] @tn: seth, are the required RequestDiscard calls even being made?
[18:44:24] seth: tn: locally, i see them being made when i close a tab, yeah
[18:44:30] seth: tn: that's what is so puzzling
....
[18:59:52] seth: tn: actually on techcrunch i can reproduce this even locally
...
[20:40:09] seth: tn: alright, i have come to a conclusion about this
[20:40:27] seth: tn: the problem is in PresShell::Destroy()
[20:41:05] seth: tn: we call ClearVisibleImagesList() *before* we call mDocument->DeleteShell()
[20:42:00] seth: tn: ClearVisibleImagesList() calls nsImageLoadingContent::DecrementVisibleCount(), which will generally end up calling nsImageLoadingContent::UntrackImage(), which calls nsDocument::RemoveImage()
[20:42:46] seth: tn: that is bad news, because now the image is not in nsDocument::mImageTracker, which means that when we call RequestDiscard() on all of the images in nsDocument::DeleteShell(), we do *not* call RequestDiscard() on most images
[20:44:11] seth: tn: the most straightforward fix i see (which is still kinda more verbose than i'd prefer, but such is life), is to route a REQUEST_DISCARD flag from ClearVisibleImagesList() all the way to nsDocument::RemoveImage()
...
[21:14:24] seth: tn: in my testing this modification results in all of the banner images and such on techcrunch getting immediately discarded when the tab is closed
[21:14:28] seth: tn: before, none of them were
I'm still waiting on try and AWSY, so I'm not yet sure how the results of the changes proposed here to compare to the results of the changes in bug 1125462. We may want both patches. I think we may have finally uncovered the fundamental problem, though.
Assignee | ||
Updated•10 years ago
|
Component: ImageLib → Layout: Images
Comment 2•10 years ago
|
||
Comment on attachment 8554136 [details] [diff] [review]
Make sure we request discarding for images in PresShell::Destroy
Using a flag for the request discard part would enforce clarity of the code in the future if any one decides to be less diligent with commenting the parameter name then you have in this patch.
Attachment #8554136 -
Flags: review?(tnikkel) → review+
Assignee | ||
Comment 3•10 years ago
|
||
(In reply to Timothy Nikkel (:tn) from comment #2)
> Using a flag for the request discard part would enforce clarity of the code
> in the future if any one decides to be less diligent with commenting the
> parameter name then you have in this patch.
Yeah, that's a good point. I should probably just move the REQUEST_DISCARD enumeration into the IDL file.
Assignee | ||
Comment 4•10 years ago
|
||
Let's consider this part 1 now.
Assignee | ||
Updated•10 years ago
|
Attachment #8554136 -
Attachment is obsolete: true
Assignee | ||
Comment 5•10 years ago
|
||
OK, here's the switch to use an enumeration. It ends up touching a lot of stuff,
so I think it's worth making this a separate patch.
Attachment #8554228 -
Flags: review?(tnikkel)
Assignee | ||
Comment 6•10 years ago
|
||
Try job here:
https://tbpl.mozilla.org/?tree=Try&rev=4f620ba0b9fb
Assignee | ||
Comment 7•10 years ago
|
||
OK, it looks like this change exposed a previously-existing race condition where
the observer in browser_bug666317.js can be destroyed before we finish tearing
down the document containing the image it's observing, resulting in a null
dereference when we try to deliver a DISCARD notification from the
RequestDiscard call we're now firing thanks to the changes in this patch.
We really need to rethink the ScriptedObserver stuff, but for now this is
extremely straightforward to fix - we inline attachDiscardObserver() into
step2(), so that a stack reference remains to the observer.
Assignee | ||
Updated•10 years ago
|
Attachment #8554227 -
Attachment is obsolete: true
Assignee | ||
Comment 8•10 years ago
|
||
New try job here:
https://tbpl.mozilla.org/?tree=Try&rev=46544db174f2
Comment 9•10 years ago
|
||
Comment on attachment 8554228 [details] [diff] [review]
(Part 2) - Use an enumeration instead of a boolean to request discarding in nsIImageLoadingContent
thanks
Attachment #8554228 -
Flags: review?(tnikkel) → review+
Assignee | ||
Comment 10•10 years ago
|
||
Thanks for the review! Pushed:
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/fa3e911c2941
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/042523d55ed8
Comment 11•10 years ago
|
||
Comment on attachment 8554228 [details] [diff] [review]
(Part 2) - Use an enumeration instead of a boolean to request discarding in nsIImageLoadingContent
Also if there ever lands without part 1 it would need an iid bump.
Assignee | ||
Comment 12•10 years ago
|
||
Yup, that's true. We'll keep them together.
Comment 13•10 years ago
|
||
Backed out in https://hg.mozilla.org/integration/mozilla-inbound/rev/1f0d37966eac - odd bedfellows, but opt Windows hung in one of the various sizes of PNG in image/test/reftest/encoders-lossless/, and Android failed a couple of tests.
Assignee | ||
Comment 14•10 years ago
|
||
OK, investigating the failure here led me to discover bug 1126038. Here's a try job with bug 1126038's patch applied:
https://tbpl.mozilla.org/?tree=Try&rev=78533be937b3
Assignee | ||
Comment 15•10 years ago
|
||
Looks like the only failure there is from bug 1126038, and I've fixed it there. Pushed:
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/bbd77af91d82
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/b44e10f83623
Comment 16•10 years ago
|
||
sorry had to back this out for test failures like https://treeherder.mozilla.org/logviewer.html#?job_id=5959006&repo=mozilla-inbound
Assignee | ||
Comment 17•10 years ago
|
||
OK, I think this is ready to go now. Pushed:
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/71bc716fc021
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/f44673d50e55
https://hg.mozilla.org/mozilla-central/rev/71bc716fc021
https://hg.mozilla.org/mozilla-central/rev/f44673d50e55
Status: NEW → RESOLVED
Closed: 10 years ago
status-firefox38:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
Assignee | ||
Comment 19•10 years ago
|
||
Comment on attachment 8554237 [details] [diff] [review]
(Part 1) - Make sure we request discarding for images in PresShell::Destroy
Approval Request Comment
[Feature/regressing bug #]: Part of fix for bug 1125272 and bug 1119938.
[User impact if declined]: Already approved.
[Describe test coverage new/current, TreeHerder]: In 38 for a long time.
[Risks and why]: Low risk; in 38 for a long time.
[String/UUID change made/needed]: None.
Attachment #8554237 -
Flags: approval-mozilla-aurora?
Assignee | ||
Updated•10 years ago
|
Attachment #8554228 -
Flags: approval-mozilla-aurora?
Assignee | ||
Comment 20•10 years ago
|
||
Pushed to Aurora:
remote: https://hg.mozilla.org/releases/mozilla-aurora/rev/63498d169679
remote: https://hg.mozilla.org/releases/mozilla-aurora/rev/7e51c23a4404
status-firefox37:
--- → fixed
Comment 21•10 years ago
|
||
Comment on attachment 8554237 [details] [diff] [review]
(Part 1) - Make sure we request discarding for images in PresShell::Destroy
Part of a collection of ImageLib work that has been tested by QE and verbally approved to land. Adding approval after the fact.
Attachment #8554237 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Updated•10 years ago
|
Attachment #8554228 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Updated•6 years ago
|
Product: Core → Core Graveyard
Updated•6 years ago
|
Product: Core Graveyard → Core
You need to log in
before you can comment on or make changes to this bug.
Description
•