gDelayedAnnotations seems to be leaked on non-Linux platforms

RESOLVED FIXED in Firefox 55

Status

()

Core
IPC
RESOLVED FIXED
5 months ago
5 months ago

People

(Reporter: mstange, Assigned: mstange)

Tracking

Trunk
mozilla55
Points:
---

Firefox Tracking Flags

(firefox55 fixed)

Details

MozReview Requests

()

Submitter Diff Changes Open Issues Last Updated
Loading...
Error loading review requests:

Attachments

(1 attachment)

(Assignee)

Description

5 months ago
I have a patch in bug 1330185 that, in rare cases, causes CrashReporter::AnnotateCrashReport to be called. This in itself did not cause a test failure, but it did cause a leak on Windows: One array ("8 bytes") got leaked.

This array turned out to be gDelayedAnnotations.

I see how gDelayedAnnotations is being used and then freed on Linux, but I don't see a use of it on Windows or Mac. Josh, do you remember writing this code? Can you explain to me how this is supposed to work?
Flags: needinfo?(josh)
(Assignee)

Comment 1

5 months ago
> Can you explain to me how this is supposed to work?

Sorry, this sounds rather passive aggressive on second read. I didn't mean it that way.

Comment 2

5 months ago
It did not come across to me as passive agressive. https://bugzilla.mozilla.org/show_bug.cgi?id=581341#c62 is the idea behind gDelayedAnnotations. I don't see why it would not be used on Windows or Mac, but I haven't looked closely at that file. It looks like a leak could occur in two situations:
* AppendAppNotesToCrashReport or AnnotateCrashReport are called, but SetRemoteExceptionHandler is never called
* AppendAppNotesToCrashReport or AnnotationCrashReport are called after CrashReporterClient::DestroySingleton

I would put money on the second option.
Flags: needinfo?(josh)
(Assignee)

Comment 3

5 months ago
Thanks.

(In reply to Josh Matthews [:jdm] from comment #2)
> I don't see why it would not be used on Windows or Mac,

There are three implementations of SetRemoteExceptionHandler in nsExceptionHandler.cpp, one for each platform (Windows / Linux / Mac). The Linux version runs these lines of code after creating gExceptionHandler:

>  if (gDelayedAnnotations) {
>    for (uint32_t i = 0; i < gDelayedAnnotations->Length(); i++) {
>      gDelayedAnnotations->ElementAt(i)->Run();
>    }
>    delete gDelayedAnnotations;
>  }

The other two implementations of SetRemoteExceptionHandler do not contain such a section.

So maybe this was just an oversight.
Assignee: nobody → mstange
Status: NEW → ASSIGNED
Comment hidden (mozreview-request)

Comment 5

5 months ago
mozreview-review
Comment on attachment 8872210 [details]
Bug 1367591 - Process gDelayedAnnotations on Windows and Mac as well, not just on Linux.

https://reviewboard.mozilla.org/r/143678/#review147554
Attachment #8872210 - Flags: review?(josh) → review+

Comment 6

5 months ago
Pushed by mstange@themasta.com:
https://hg.mozilla.org/integration/autoland/rev/cc62547d3415
Process gDelayedAnnotations on Windows and Mac as well, not just on Linux. r=jdm

Comment 7

5 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/cc62547d3415
Status: ASSIGNED → RESOLVED
Last Resolved: 5 months ago
status-firefox55: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.