Bug 1473191

Summary: mem-pool: mem_pool_fini() doesn't release entire memory allocated
Product: [Red Hat Storage] Red Hat Gluster Storage Reporter: Niels de Vos <ndevos>
Component: coreAssignee: Niels de Vos <ndevos>
Status: CLOSED CURRENTRELEASE QA Contact: Rahul Hinduja <rhinduja>
Severity: high Docs Contact:
Priority: medium    
Version: rhgs-3.3CC: amukherj, atumball, madam, ndevos, rcyriac, rhs-bugs, skoduri, storage-qa-internal
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: glusterfs-3.12.2-18 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-24 11:51:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1470170    
Bug Blocks: 1196020    

Description Niels de Vos 2017-07-20 08:20:24 UTC
Description of problem:

At the moment, all the work which mem_pool_fini() does is to exit and cleanup the sweeper thread. That doesn't ensure that all the memory allocated is cleaned up as some of those allocations may still be in hot list or if in cold list, sweeper thread may not have got chance to run through them.
hence we need to iterate though all those per-thread mem-pools and clean them up as part of mem_pools_fini().

This is mainly important for applications where glfs_init() and glfs_fini() can be called a number of times during the application runtime (NFS-Ganesha, QEMU, libvirt, ...).

Version-Release number of selected component (if applicable):
any version that support brick-multiplexing (which sneaked in new mem-pools)

How reproducible:
100%

Steps to Reproduce:
1. call glfs_init() and glfs_fini() in an application running under Valgrind
2. notice the major increase in memory leaks related to mem_get()

Actual results:
There are known memory leaks in libglusterfs (that is used by all Gluster executables). But the brick-multiplex feature increased the number of leaks significantly.

Expected results:
No increase in memory leaks (ideally the number of leaks compared to previous versions would be reduced).

Additional info:
The series of patches that makes sure to release the allocated memory when mem_pools_fini() is called can be found at https://review.gluster.org/#/q/topic:bug-1470170

Comment 3 Atin Mukherjee 2017-07-20 13:14:13 UTC
upstream patch(es) : https://review.gluster.org/#/q/topic:bug-1470170

Comment 7 Amar Tumballi 2018-02-06 05:21:11 UTC
These patches are already part of release-3.12 branch, and hence will be part of RHGS3.4 release.