
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