Closed Bug 1677866 Opened 5 years ago Closed 4 years ago

Memory allocated by `cert_storage` rust crate not reported to about:memory

Categories

(Core :: Security: PSM, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
90 Branch
Tracking Status
firefox90 --- fixed

People

(Reporter: nika, Assigned: rmf)

References

Details

Attachments

(3 files)

When running the DMD tool to identify heap-unclassified memory in Gecko, I noticed that a significant amount of allocated memory is allocated by the cert_storage rust crate, specifically with stacks resizing hashtables from load_crlite_stash (https://searchfox.org/mozilla-central/rev/277ab3925eae21b419167a34624ec0ab518d0c94/security/manager/ssl/cert_storage/src/lib.rs#457).

On my local machine, this one allocation site amounted to over 8MB of heap-unclassified memory in the parent process due to this field: https://searchfox.org/mozilla-central/rev/277ab3925eae21b419167a34624ec0ab518d0c94/security/manager/ssl/cert_storage/src/lib.rs#457.

These objects should be integrated with our existing memory infrastructure so they do not appear as heap-unclassified in views such as about:memory.

I believe this can be done using a similar strategy to what is taken by webrender and servo using the malloc_size_of crate and some manual integration with the c++ reporting infrastructure.

Attached a more complete DMD report which is filtered to list all stack frames containing 'cert_storage'.

To fix this, we should probably use the malloc_size_of / malloc_size_of_derive crates that style and webrender use... Happy to help getting them hooked up, though it should be easy-ish.

The severity field is not set for this bug.
:keeler, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(dkeeler)

Martinho, any interest in implementing this?

Severity: -- → S3
Flags: needinfo?(dkeeler) → needinfo?(bugs)

Sure, I can give this a try.

Flags: needinfo?(bugs)
Assignee: nobody → bugs

Hello R. Martinho. Are you actually working on this bug? Given that there are a lot of those unreported heap unclassified entries in the DMD report it would be good to see them correctly reported.

Flags: needinfo?(bugs)

Henrik, I haven't had time to work on this one yet. If you're asking because you want to pick it up yourself, feel free.

Flags: needinfo?(bugs)

No I won't be able to do it on my own, but I do lots of DMD investigations so that it would be helpful.

Assignee: bugs → nobody

Hi Dana, I don't know how complicated / time invasive it is to get implemented but for tracking down heap-unclassified memory it would be a great help to have. It's reported a lot and as such makes it harder to actually find other issues. Maybe someone could have a look at this? Thanks.

Flags: needinfo?(dkeeler)

Hi Henrik. I will start working on this.

Assignee: nobody → bugs
Flags: needinfo?(dkeeler)

Thanks a lot.

Status: NEW → ASSIGNED
Type: defect → task
Priority: -- → P2
Type: task → enhancement

Martinho, please add Dana and mccr8 as reviewers when this is ready for review.

Attachment #9206710 - Attachment description: Bug 1677866 - Report memory allocated by `cert_storage` crate → Bug 1677866 - Report memory allocated by `cert_storage` crate r?keeler

Hello Martinho, I wanted to ask if you had a bit of time to already check or even work on the review comments from Dana. Thanks!

Flags: needinfo?(bugs)

Hi Henry, I was away last week but I'm working on it now.

Flags: needinfo?(bugs)
Pushed by archaeopteryx@coole-files.de: https://hg.mozilla.org/integration/autoland/rev/faf00b1dcf5d Report memory allocated by `cert_storage` crate r=keeler,emilio
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 90 Branch

R. Martinho thanks a lot for getting this landed!

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: