[LU-16575] UDSP memory leak Created: 17/Feb/23  Updated: 31/Mar/23  Resolved: 31/Mar/23

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: Lustre 2.16.0

Type: Bug Priority: Minor
Reporter: Chris Horn Assignee: Chris Horn
Resolution: Fixed Votes: 0
Labels: None

Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

There is a small memory leak reported by libcfs when using udsp.

[root@el8-mds2 ~]# dmesg -C
[root@el8-mds2 ~]# start.sh
insmod /home/hornc/lustre-wc-rel/libcfs/libcfs/libcfs.ko
insmod /home/hornc/lustre-wc-rel/lnet/lnet/lnet.ko
insmod /home/hornc/lustre-wc-rel/lnet/klnds/socklnd/ksocklnd.ko
debug=+net malloc
[root@el8-mds2 ~]# lnetctl udsp add --src tcp --priority 1
[root@el8-mds2 ~]# lustre_rmmod
[root@el8-mds2 ~]# dmesg | tail
[66520.595537] LNet: HW NUMA nodes: 1, HW CPU cores: 2, npartitions: 1
[66520.600543] alg: No test for adler32 (adler32-zlib)
[66521.319208] Key type ._llcrypt registered
[66521.319558] Key type .llcrypt registered
[66531.530270] LNet: 26041:0:(lib-ptl.c:956:lnet_clear_lazy_portal()) Active lazy portal 0 on exit
[66531.580271] Key type .llcrypt unregistered
[66531.581053] Key type ._llcrypt unregistered
[66531.586086] LNetError: 26089:0:(module.c:948:libcfs_exit()) Portals memory leaked: 32 bytes
[root@el8-mds2 ~]#


 Comments   
Comment by Chris Horn [ 17/Feb/23 ]
[root@el8-mds2 ~]# clean.sh
[root@el8-mds2 ~]# start.sh
insmod /home/hornc/lustre-wc-rel/libcfs/libcfs/libcfs.ko
insmod /home/hornc/lustre-wc-rel/lnet/lnet/lnet.ko
insmod /home/hornc/lustre-wc-rel/lnet/klnds/socklnd/ksocklnd.ko
debug=+net malloc
[root@el8-mds2 ~]# lctl clear
[root@el8-mds2 ~]# lnetctl udsp add --src tcp --priority 0
[root@el8-mds2 ~]# lnetctl udsp del --idx 0
[root@el8-mds2 ~]# lctl dk > /tmp/dk.log
[root@el8-mds2 ~]# perl /home/hornc/lustre-wc-rel/lustre/tests/leak_finder.pl /tmp/dk.log
Starting analysis since 0
   freed    128 bytes at 00000000e6076820 called hdr (module.c:libcfs_ioctl:238)
*** Free without malloc (128 bytes at 00000000e6076820, module.c:libcfs_ioctl:238)
   alloc     80 bytes at 0000000040ed7d27 called (*hdr_pp) (module.c:libcfs_ioctl_getdata:166)
   alloc    176 bytes at 000000004bc99907 called udsp (udsp.c:lnet_udsp_alloc:1099)
   alloc     32 bytes at 000000003b7c561d called (buf) (udsp.c:copy_ioc_udsp_descr:1496)
   freed     80 bytes at 0000000040ed7d27 called hdr (module.c:libcfs_ioctl:238)
   alloc     32 bytes at 00000000e7e1a5ff called (*hdr_pp) (module.c:libcfs_ioctl_getdata:166)
   freed    176 bytes at 000000004bc99907 called udsp (udsp.c:lnet_udsp_free:1132)
   freed     32 bytes at 00000000e7e1a5ff called hdr (module.c:libcfs_ioctl:238)
*** Leak: 32 bytes allocated at 000000003b7c561d (udsp.c:copy_ioc_udsp_descr:1496:(buf), debug file line 10)
maximum used: 288, amount leaked: 32
[root@el8-mds2 ~]#
Comment by Gerrit Updater [ 21/Feb/23 ]

"Chris Horn <chris.horn@hpe.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/50081
Subject: LU-16575 lnet: memory leak in copy_ioc_udsp_descr
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 0efd4006770844f73dba8057b5f8283f3034d4c4

Comment by Gerrit Updater [ 08/Mar/23 ]

"Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/50081/
Subject: LU-16575 lnet: memory leak in copy_ioc_udsp_descr
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: f8e129198b002589daf4acdaf10cb970e9dab44a

Generated at Sat Feb 10 03:28:12 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.