Memory leak in snmp-agent.py

Description

A memory leak in snmp-agent.py can be observed:

https://grafana.adm.kojedz.in/dashboard/snapshot/nwtW56cywOoVVHd7PIrPskTz0RmPYiPV

This is 14 hours of snmp-agent running on a small TrueNAS system.

Problem/Justification

None

Impact

None

Activity

Show:

Richard Kojedzinszky January 12, 2022 at 12:23 PM

Running snmp-agent with the patches seems to be working, not leaking memory. This is after 12hours only, howewer, with earlier libzfs memory leak was visible in similar time interval.

Ryan Moeller January 11, 2022 at 7:28 PM

Ryan Moeller January 10, 2022 at 3:02 PM

Yes that's what I've found as well.

Richard Kojedzinszky January 9, 2022 at 7:22 PM
Edited

It seems that struct mnttab in openzfs (lib/libspl/include/os/freebsd/sys/mnttab.h) have char* members, and https://github.com/openzfs/zfs/blob/master/lib/libspl/os/freebsd/mnttab.c#L95 fills those with strdup()s, but there are several places where they are not freed.

In https://github.com/openzfs/zfs/blob/master/lib/libzfs/libzfs_dataset.c#L872, if libzfs_mnttab_enable is not enabled, the returned mnttab will have strdup-ped values. Howewer, if libzfs_mnttab_enable is enabled, the values will be populated in a cache, and returned, no strdup()s will be made in later calls.

 

Am I right?

Waqar January 9, 2022 at 5:09 PM

The leak is originating from getmntany in libzfs

Complete

Details

Assignee

Reporter

Labels

Impact

Medium

Time remaining

0m

Components

Fix versions

Affects versions

Priority

Katalon Platform

Created January 4, 2022 at 5:52 AM
Updated July 1, 2022 at 5:55 PM
Resolved January 20, 2022 at 5:59 PM