Closed Bug 738774 Opened 13 years ago Closed 13 years ago

[Page Thumbnails] Channel leaks intermittently

Categories

(Firefox :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 14

People

(Reporter: ttaubert, Assigned: ttaubert)

References

Details

(Keywords: memory-leak, Whiteboard: [MemShrink:P1])

Attachments

(1 file)

Attached patch patch v1Splinter Review
The PageThumbs channel is leaking intermittently and that's the cause of bug 735574. I wasn't able to find out what the exact cause of the leak was but looking at the HttpChannel implementation we're doing too much work anyway at the moment. I rewrote the Channel from scratch, guided by the HttpChannel implementation, using an InputStreamPump to deliver the image data. The leak isn't reproducible for me anymore. The try run doesn't show any leaks well: https://tbpl.mozilla.org/?tree=Try&rev=a06133ba8471
Attachment #608846 - Flags: review?(dietrich)
Whiteboard: [MemShrink]
Comment on attachment 608846 [details] [diff] [review] patch v1 Review of attachment 608846 [details] [diff] [review]: ----------------------------------------------------------------- r=me, yeah a pump is better here. the channel+request in a single object is always spaghetti, but i didn't see anything obviously wrong. i'm not super happy that we still don't know exactly what was happening, but let's roll with it to fix the leak for now. ::: browser/components/thumbnails/PageThumbsProtocol.js @@ +165,5 @@ > + > + function trackThumbnailHitOrMiss(aThumbnailFound) { > + Services.telemetry.getHistogramById("FX_THUMBNAILS_HIT_OR_MISS") > + .add(aThumbnailFound); > + } for clarity, should either have this as a method of the channel, or at least defined before use.
Attachment #608846 - Flags: review?(dietrich) → review+
(In reply to Dietrich Ayala (:dietrich) from comment #1) > i'm not super happy that we still don't know exactly what was happening, but > let's roll with it to fix the leak for now. I could imagine that maybe the asyncCopy() callback kept things alive and now that we can just cancel the pump there is nothing alive anymore. > > + function trackThumbnailHitOrMiss(aThumbnailFound) { > > + Services.telemetry.getHistogramById("FX_THUMBNAILS_HIT_OR_MISS") > > + .add(aThumbnailFound); > > + } > > for clarity, should either have this as a method of the channel, or at least > defined before use. Moved to its own method.
Whiteboard: [MemShrink] → [MemShrink][fixed-in-fx-team]
Target Milestone: --- → Firefox 14
Whiteboard: [MemShrink][fixed-in-fx-team] → [MemShrink:P1][fixed-in-fx-team]
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Whiteboard: [MemShrink:P1][fixed-in-fx-team] → [MemShrink:P1]
Comment on attachment 608846 [details] [diff] [review] patch v1 [Approval Request Comment] User impact if declined: possible leaks when showing thumbnails (i.e. opening the newtab page) Testing completed (on m-c, etc.): landed on m-c ~3 days ago, no regressions so far Risk to taking this patch (and alternatives if risky): risk seems low, we can't say for sure that those were "real" leaks occurring in the wild String changes made by this patch: none
Attachment #608846 - Flags: approval-mozilla-aurora?
I'm having a hard time weighing (In reply to Tim Taubert [:ttaubert] from comment #5) > User impact if declined: possible leaks when showing thumbnails (i.e. > opening the newtab page) > Risk to taking this patch (and alternatives if risky): risk seems low, we > can't say for sure that those were "real" leaks occurring in the wild > String changes made by this patch: none against the fact that this patch was a complete rewrite of the PageThumbs channel. I know we can't say whether users are running into this, but is there any way to reason about the worst this memory leak could end up being in normal user scenarios?
I'm not really confident about what caused the leak but I *think* it was caused by using NetUtils.asyncCopy() which held the callback/closure alive even though the image request has been cancelled already. The leak was frequent but still intermittent so I think it was only because the code was kept alive a little longer than it should've been. I'm talking about probably less than 5 seconds only when quickly opening and closing the new tab page.
(In reply to Tim Taubert [:ttaubert] from comment #7) > I'm talking about > probably less than 5 seconds only when quickly opening and closing the new > tab page. Sorry, what's the amount of memory leaked each time a user opens the new tab page in our tests?
So my guess is that we could be leaking ~46kb when quickly opening and closing the newtab page for some seconds only. We don't leak when opening the newtab page - it's about the images being loaded. When they're not loaded completely before closing the page we leak them until they're loaded (which should only be a second or two, worst). If we shut down the browser while these are still loading we have our intermittent leak. I'd probably not backport this fix for Fx 13 as I don't think this will really affect users in the wild and may not be worth the risk.
Comment on attachment 608846 [details] [diff] [review] patch v1 [Triage Comment] I agree with Tim's analysis that this fix is likely unnecessary for FF13, and carries greater than usual risk based upon the fact that this is a code rewrite.
Attachment #608846 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: