Closed Bug 1420677 Opened 7 years ago Closed 5 years ago

Convert nsHostResolver.addr_info to a UniquePtr

Categories

(Core :: Networking: DNS, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox-esr60 --- wontfix
firefox66 --- wontfix
firefox67 --- wontfix
firefox68 --- fixed

People

(Reporter: jthemphill, Assigned: valentin, Mentored)

References

Details

(Keywords: memory-leak, Whiteboard: [necko-triaged][MemShrink:P2])

Attachments

(4 files)

Blocks: 1185120
Depends on: 1420673
Attached patch addr_info.patchSplinter Review
This patch depends on the patch I submitted for Bug 1420673. I can switch the order pretty easily. I'm not sure how to make MozReview work with stacked patches and stacked bugs (I got the error "abort: cannot submit reviews referencing multiple bugs"), so I'm just submitting this the old-fashioned way.

Hopefully after we convert these over we'll be able to land Bug 1403802 without any memory leak complaints.
Attachment #8931915 - Flags: review?(valentin.gosu)
Err, I mean we'll be able to land Bug 1417827.
Blocks: 1417827
(In reply to jthemphill from comment #2)
> Err, I mean we'll be able to land Bug 1417827.

Does your push include the patch from Bug 1417827? Just to confirm that the leak was actually caused by this?
Assignee: nobody → jthemphill
Whiteboard: [necko-triaged]
Yep! The tryserver commit hash for my push is d822df2aa260. You can see the `NSCString`s here: https://hg.mozilla.org/try/file/d822df2aa2608cdeb34d1f6a1a7893247daefccb/netwerk/dns/DNS.h#l153
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment on attachment 8931915 [details] [diff] [review]
addr_info.patch

Review of attachment 8931915 [details] [diff] [review]:
-----------------------------------------------------------------

You can submit individual patches for review by doing `hg push review -c <changeset_id>`
Attachment #8931915 - Flags: review?(valentin.gosu) → review+
This can be checked in once the patch for Bug 1420673 is checked in.
Keywords: checkin-needed
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/27719294cb73
Convert nsHostResolver.addr_info to a UniquePtr. r=valentin
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/27719294cb73
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
Depends on: 1422173
Okay, I guess the memory leak was here: https://hg.mozilla.org/integration/mozilla-inbound/file/tip/netwerk/dns/nsHostResolver.cpp#l873

The leak occurred because we had set the pointer to null but didn't free the underlying data. Now that we're using UniquePtr, we're good to go!
That seems to be the case. Anyway, thanks for working on all these patches! It's proved to be very useful.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Priority: -- → P3
Assignee: jthemphill → valentin.gosu
Pushed by valentin.gosu@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/edff1f39d426
Make AddrInfo.mAddresses an AutoCleanLinkedList r=dragana
https://hg.mozilla.org/integration/autoland/rev/cf114035c79f
Make AddrHostRecord.addr_info a RefPtr r=dragana
Status: REOPENED → RESOLVED
Closed: 7 years ago5 years ago
Resolution: --- → FIXED
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Status: REOPENED → RESOLVED
Closed: 5 years ago5 years ago
Resolution: --- → FIXED
Status: RESOLVED → REOPENED
Resolution: FIXED → ---

When changing addr_info we didn't always update addr_info_gencnt, so when it the old AddrInfo was freed, even though we lock in nsDNSRecord::GetNextAddr, mIter would still point to the old AddrInfo.

Pushed by valentin.gosu@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/a9243110b784
Make AddrHostRecord.addr_info a RefPtr r=dragana
https://hg.mozilla.org/integration/autoland/rev/661bfa5ea263
Make AddrInfo.mAddresses an AutoCleanLinkedList r=dragana
https://hg.mozilla.org/integration/autoland/rev/1d783ed68779
Make sure to update addr_info_gencnt each time we change addr_info r=dragana
Status: REOPENED → RESOLVED
Closed: 5 years ago5 years ago
Resolution: --- → FIXED
Target Milestone: mozilla59 → mozilla68
Keywords: memory-leak
Whiteboard: [necko-triaged] → [necko-triaged][MemShrink:P2]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: