1. Yes, our testers opened some compilation options, such as -fsanitizer=leak.
2. The version of libvirt we are using is 3.2.0. Our tester deployed a long-lived
environment and did many operations (he didn't remember what he did),
such as restarting virtlogd, restarting libvirtd, creating virtual machines, kill -9
virtlogd, libvirtd, etc.
-----Original Message-----
From: Michal Privoznik [mailto:mprivozn@redhat.com]
Sent: Tuesday, June 16, 2020 9:58 PM
To: wangjian (AN) <wangjian161(a)huawei.com>
Cc: libvir-list(a)redhat.com
Subject: Re: [PATCH] virtlogd: solve some memory leaks
On 6/16/20 8:26 AM, wangjian wrote:
We used asan to find some memory leaks in virtlogd. In the
virThreadPoolFree function, When job->data is of type virNetServerJobPtr, the
following memory leak problem exists.
1. job->data is not released
Direct leak of 24 byte(s) in 1 object(s) allocated from:
#0 0x7f14ab932560 in calloc (/usr/local/gcc-6-4/lib64/libasan.so.3+0xc7560) ??:?
#1 0x55ab07088853 in virAlloc (/usr/sbin/virtlogd+0x31853)
/usr/src/debug/libvirt-3.2.0-529.x86_64/src/util/viralloc.c:144
#2 0x55ab0707a515 (/usr/sbin/virtlogd+0x23515)
/usr/src/debug/libvirt-3.2.0-529.x86_64/src/rpc/virnetserver.c:209
#3 0x55ab07076d87 (/usr/sbin/virtlogd+0x1fd87)
/usr/src/debug/libvirt-3.2.0-529.x86_64/src/rpc/virnetserverclient.c:1374
#4 0x55ab070770e2 (/usr/sbin/virtlogd+0x200e2)
/usr/src/debug/libvirt-3.2.0-529.x86_64/src/rpc/virnetserverclient.c:1563
#5 0x55ab0709c67f in virEventPollRunOnce (/usr/sbin/virtlogd+0x4567f)
/usr/src/debug/libvirt-3.2.0-529.x86_64/src/util/vireventpoll.c:508
#6 0x55ab0709ad30 in virEventRunDefaultImpl (/usr/sbin/virtlogd+0x43d30)
/usr/src/debug/libvirt-3.2.0-529.x86_64/src/util/virevent.c:314
#7 0x55ab07079f6c in virNetDaemonRun (/usr/sbin/virtlogd+0x22f6c)
/usr/src/debug/libvirt-3.2.0-529.x86_64/src/rpc/virnetdaemon.c:847
#8 0x55ab070714db in main (/usr/sbin/virtlogd+0x1a4db)
/usr/src/debug/libvirt-3.2.0-529.x86_64/src/logging/log_daemon.c:1162
#9 0x7f14aa3c2c56 in __libc_start_main (/usr/lib64/libc.so.6+0x25c56) ??:?
#10 0x55ab07072639 in _start (/usr/sbin/virtlogd+0x1b639) ??:?
Hey,
firstly, I'm interested how you used asan. By providing -fsanitize=address to CFLAGS?
Secondly, can you test the latest master? The memleaks you attach show libvirt-3.2.0.
I've ran valgrind over the latest master but was unable to reproduce any leak:
==107012== definitely lost: 0 bytes in 0 blocks
==107012== indirectly lost: 0 bytes in 0 blocks
==107012== possibly lost: 1,368 bytes in 19 blocks
What do I need to do to reproduce?
Michal