Closed Bug 2022247 Opened 8 months ago Closed 8 months ago

Exchange servers and clients can cause memory leaks by holding onto referrences on each other

Categories

(MailNews Core :: Networking: Exchange, defect)

defect

Tracking

(Not tracked)

RESOLVED FIXED
150 Branch

People

(Reporter: babolivier, Assigned: babolivier)

References

(Blocks 1 open bug)

Details

Attachments

(1 external file)

As per Matrix:

EwsOutgoingServer holds a reference on its XpComEwsClient, and the XpComEwsClient also holds a reference to the EwsOutgoingServer (via the OperationSender). So when the outgoing server gets removed, the client is stopped but none of the EwsOutgoingServer, XpComEwsClient, OperationQueue or OperationSender are dropped. I think it might be happening with incoming servers too.

This should only happen at shutdown or when an account/server is manually removed, and those data structures don't hold a lot of data in memory, so it shouldn't have a huge impact, but it's probably worth taking care of it now we know it's here.

I ended up needing to pull in async-lock for its Mutex, to avoid the rare
panic if we end up shutting down at the same time we're e.g. computing
credentials.

This patch also uses the absence of a RefPtr<ServerT> in the OperationSender
as a signal that we've already shut down, which works as an "atomic" indicator,
but could be confusing. I'm happy to change it for something else if preferred.

Target Milestone: --- → 150 Branch

Pushed by jtracey@thunderbird.net:
https://hg.mozilla.org/comm-central/rev/9f29a90d7ebd
Drop the EWS operation sender's reference on its server upon shutdown. r=edicharry

Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: