Closed
Bug 1180105
Opened 11 years ago
Closed 11 years ago
memory leak with mjpeg based webcams
Categories
(Core :: Graphics: ImageLib, defect)
Tracking
()
RESOLVED
FIXED
mozilla42
| Tracking | Status | |
|---|---|---|
| firefox40 | --- | unaffected |
| firefox41 | --- | unaffected |
| firefox42 | + | fixed |
People
(Reporter: alice0775, Assigned: ehsan.akhgari)
References
Details
(Keywords: memory-leak, regression, reproducible)
Attachments
(2 files)
|
80.00 KB,
application/x-gzip
|
Details | |
|
7.18 KB,
patch
|
seth
:
review+
|
Details | Diff | Splinter Review |
Original reported Post http://forums.mozillazine.org/viewtopic.php?p=14220785#p14220785
Nightly process keeps growing on memory until i close the tab (with no add-on enabled).
Steps to reproduce:
1. open http://abbatucci.aliopolis.eu:8090/home.html?src=5&mode=1
Actual results:
Nightly process keeps growing on memory (approx. 5Mbyte/sec).
Reproduced with/without e10s.
Regression window:
GOOD : 20150630115143 https://hg.mozilla.org/integration/mozilla-inbound/rev/c97c48655c82
BAD : 20150630115343 https://hg.mozilla.org/integration/mozilla-inbound/rev/d418eb96a90d
Pushlog : https://hg.mozilla.org/integration/mozilla-inbound/pushloghtml?changeset=d418eb96a90d
Regressed by: Bug 1161627
Flags: needinfo?(nfroyd)
| Reporter | ||
Updated•11 years ago
|
Component: General → MFBT
| Reporter | ||
Comment 1•11 years ago
|
||
Comment 2•11 years ago
|
||
Ugh. Do you need a webcam to reproduce this?
This ought to be easily diagnosed with a debug build, as we're leaking a refcounted thing. And it's probably something that's not tested in mochitests or similar, or we'd notice (plus the DEBUG-mode asserts for already_AddRefed clearing out its pointer prior to destruction.
I'm out today, so I won't be able to look at this until Monday, and I won't be able to look at this at all without a webcam, if the testcase requires it. Ehsan, are you able to poke at this with a debug build?
Flags: needinfo?(nfroyd)
Flags: needinfo?(ehsan)
Flags: needinfo?(alice0775)
| Reporter | ||
Comment 3•11 years ago
|
||
(In reply to Nathan Froyd [:froydnj] [:nfroyd] from comment #2)
> Ugh. Do you need a webcam to reproduce this?
>
Not need. Just open the url
Flags: needinfo?(alice0775)
| Assignee | ||
Updated•11 years ago
|
Assignee: nobody → ehsan
Flags: needinfo?(ehsan)
| Assignee | ||
Comment 4•11 years ago
|
||
This is an issue with mjpeg streams serving images faster than we can decode. test_bug733553.html sort of tests this code path but it waits for each image to fully load before starting to load the next one, which is not quite what we want. I'll try to write a better test.
| Assignee | ||
Updated•11 years ago
|
Component: MFBT → ImageLib
| Assignee | ||
Comment 5•11 years ago
|
||
Attachment #8629393 -
Flags: review?(seth)
| Assignee | ||
Comment 6•11 years ago
|
||
Note that this leak would be caught by the test that I have added as a fatal assertion in ~already_AddRefed.
Comment 7•11 years ago
|
||
Comment on attachment 8629393 [details] [diff] [review]
Do not leak the SourceSurface returned from imgIContainer::GetFrame in BlockUntilDecodedAndFinishObserving
Review of attachment 8629393 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good. Thanks Ehsan.
::: image/MultipartImage.cpp
@@ +39,5 @@
> {
> // Use GetFrame() to block until our image finishes decoding.
> + nsRefPtr<SourceSurface> surface =
> + mImage->GetFrame(imgIContainer::FRAME_CURRENT,
> + imgIContainer::FLAG_SYNC_DECODE);
The original code leaks?! I thought already_AddRefed<> would free the thing it's pointing to on destruction. Good to know that's not the case.
Attachment #8629393 -
Flags: review?(seth) → review+
Comment 8•11 years ago
|
||
(In reply to Seth Fowler [:seth] from comment #7)
> ::: image/MultipartImage.cpp
> @@ +39,5 @@
> > {
> > // Use GetFrame() to block until our image finishes decoding.
> > + nsRefPtr<SourceSurface> surface =
> > + mImage->GetFrame(imgIContainer::FRAME_CURRENT,
> > + imgIContainer::FLAG_SYNC_DECODE);
>
> The original code leaks?! I thought already_AddRefed<> would free the thing
> it's pointing to on destruction. Good to know that's not the case.
The original code prior to s/TemporaryRef/already_AddRefed/ didn't leak, because TemporaryRef more-or-less functioned as a smart pointer, i.e. Release'ing the pointer upon destruction. already_AddRefed is stricter: it expects you to have done something with the pointer contained within it and does not Release the pointer itself.
| Assignee | ||
Comment 9•11 years ago
|
||
Right. Also, already_AddRefed() does a fatal assertion in its dtor to make sure its mRawPtr has been nulled out, but we were doubly unfortunate here in that the branch that we called BlockUntilDecodedAndFinishObserving() in was never hit in any of our tests since in the only one test that I could find which hit this code, we would wait for each image frame to load, therefore we would never be blocked on the decoder. :-)
Comment 10•11 years ago
|
||
| Assignee | ||
Comment 11•11 years ago
|
||
BTW I filed bug 1180993 to help us catch future mistakes like this at compile time.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
Updated•11 years ago
|
You need to log in
before you can comment on or make changes to this bug.
Description
•