Closed Bug 1367591 Opened 3 years ago Closed 3 years ago

gDelayedAnnotations seems to be leaked on non-Linux platforms

Categories

(Core :: IPC, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: mstange, Assigned: mstange)

References

Details

Attachments

(1 file)

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)
> 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.
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)
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 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+
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
https://hg.mozilla.org/mozilla-central/rev/cc62547d3415
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.