ASAN: memory leak when closing inactive connection
Start server:
% ../daemon/kresd -c config.lua
[system] interactive mode
>
Create idle connection:
% (echo; sleep 5) | socat - "TCP:[::1]:5300"
%
Terminate server:
> quit()
nil
>
=================================================================
==24562==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 16400 byte(s) in 1 object(s) allocated from:
#0 0x7f56df401d88 in malloc (/lib64/libasan.so.3+0xc6d88)
#1 0x7f56df0e20a4 (/lib64/libkres.so.1+0x160a4)
SUMMARY: AddressSanitizer: 16400 byte(s) leaked in 1 allocation(s).
- Show closed items
Activity
-
Newest first Oldest first
-
Show all activity Show comments only Show history only
- Reporter
Is this master? Can't reproduce.
- Author Guest
Yes, 95b243f0, gcc-6.1.1,
make CC=gcc CFLAGS=-fsanitize=address
. Nothing else. - Author Guest
And also with clang 3.8.0.
- Guest
I can reproduce with
clang-4.0 (svn)
:================================================================= ==3398==ERROR: LeakSanitizer: detected memory leaks Direct leak of 16400 byte(s) in 1 object(s) allocated from: #0 0x7f11c7220ca8 (/tmp/knot-resolver.QKXlSw/sbin/kresd+0xedca8) #1 0x7f11c6ca828b (/tmp/knot-resolver.QKXlSw/lib/libkres.so.2+0x4428b) #2 0x7f11c6ca7628 (/tmp/knot-resolver.QKXlSw/lib/libkres.so.2+0x43628) #3 0x7f11c725f3a0 (/tmp/knot-resolver.QKXlSw/sbin/kresd+0x12c3a0) #4 0x7f11c7260c39 (/tmp/knot-resolver.QKXlSw/sbin/kresd+0x12dc39) #5 0x7f11c7258ff8 (/tmp/knot-resolver.QKXlSw/sbin/kresd+0x125ff8) #6 0x7f11c63b57b3 (/usr/lib/x86_64-linux-gnu/libuv.so.1+0x137b3) SUMMARY: AddressSanitizer: 16400 byte(s) leaked in 1 allocation(s).
- Guest
Partial symbolize:
================================================================= ==9963==ERROR: LeakSanitizer: detected memory leaks Direct leak of 16400 byte(s) in 1 object(s) allocated from: #0 0x7f3e1ca88ca8 in malloc ??:? #1 0x7f3e1ca88ca8 in ?? ??:0 #2 0x7f3e1c51028b in mp_new_big_chunk mempool.c:89 #3 0x7f3e1c51028b in ?? ??:0 #4 0x7f3e1c50f628 in mp_new mempool.c:136 #5 0x7f3e1c50f628 in ?? ??:0 #6 0x7f3e1cac73a0 in qr_task_create worker.c:220 #7 0x7f3e1cac73a0 in ?? ??:0 #8 0x7f3e1cac8c39 in worker_process_tcp worker.c:923 #9 0x7f3e1cac8c39 in ?? ??:0 #10 0x7f3e1cac0ff8 in tcp_recv io.c:213 #11 0x7f3e1cac0ff8 in ?? ??:0 #12 0x7f3e1bc1d7b3 in uv_signal_stop ??:? #13 0x7f3e1bc1d7b3 in ?? ??:0 SUMMARY: AddressSanitizer: 16400 byte(s) leaked in 1 allocation(s).
- Guest
A bit better symbolize output:
================================================================= ==29161==ERROR: LeakSanitizer: detected memory leaks Direct leak of 16400 byte(s) in 1 object(s) allocated from: #0 0x7f993bae1ca8 in malloc ??:? #1 0x7f993bae1ca8 in ?? ??:0 #2 0x7f993b56928b in mp_new_big_chunk /home/ondrej/Projects/knot-resolver/contrib/ucw/mempool.c:89 #3 0x7f993b56928b in ?? ??:0 #4 0x7f993b568628 in mp_new /home/ondrej/Projects/knot-resolver/contrib/ucw/mempool.c:136 #5 0x7f993b568628 in ?? ??:0 #6 0x7f993bb203a0 in qr_task_create /home/ondrej/Projects/knot-resolver/daemon/worker.c:220 #7 0x7f993bb203a0 in ?? ??:0 #8 0x7f993bb21c39 in worker_process_tcp /home/ondrej/Projects/knot-resolver/daemon/worker.c:923 #9 0x7f993bb21c39 in ?? ??:0 #10 0x7f993bb19ff8 in tcp_recv /home/ondrej/Projects/knot-resolver/daemon/io.c:213 #11 0x7f993bb19ff8 in ?? ??:0 #12 0x7f993ac767b3 in uv_signal_stop ??:? #13 0x7f993ac767b3 in ?? ??:0 SUMMARY: AddressSanitizer: 16400 byte(s) leaked in 1 allocation(s).
- Ondřej Surý changed milestone to %1.2.0 release
changed milestone to %1.2.0 release
- Ondřej Surý assigned to @vcunat
assigned to @vcunat
- Owner
I'm getting a much simpler trace (I don't know why):
==10890==ERROR: LeakSanitizer: detected memory leaks Direct leak of 1679 byte(s) in 1 object(s) allocated from: #0 0x7f2a55917438 in __interceptor_malloc (/nix/store/g8xd4wc3yskkkws8vl17ycchgrxzcbr7-gcc-6.2.0-lib/lib/libasan.so.3+0xc1438) #1 0x557912c69efe in get_ephemeral_privkey daemon/tls_ephemeral_credentials.c:98 #2 0x557912c69efe in tls_get_ephemeral_credentials daemon/tls_ephemeral_credentials.c:219 SUMMARY: AddressSanitizer: 1679 byte(s) leaked in 1 allocation(s).
- Owner
Oh, the ephemeral changes merged today... perhaps it changes this issue.
- Owner
But non-TLS trace is also simpler:
==11104==ERROR: LeakSanitizer: detected memory leaks Direct leak of 16400 byte(s) in 1 object(s) allocated from: #0 0x7f04b4f2c438 in __interceptor_malloc (/nix/store/g8xd4wc3yskkkws8vl17ycchgrxzcbr7-gcc-6.2.0-lib/lib/libasan.so.3+0xc1438) #1 0x7f04b4be1d54 in mp_new_big_chunk contrib/ucw/mempool.c:89 SUMMARY: AddressSanitizer: 16400 byte(s) leaked in 1 allocation(s).
EDIT: I used gcc's asan instead of clang's; I'm really absent-minded today.
Edited by Vladimír Čunát - Vladimír Čunát mentioned in commit f50a9cc9
mentioned in commit f50a9cc9
- Owner
All the leaks above seem fixed by !114 (merged).
- Vladimír Čunát closed via commit f50a9cc9
closed via commit f50a9cc9
- Ondřej Surý closed via commit 7daf9ecc
closed via commit 7daf9ecc
- Ondřej Surý closed via merge request !114 (merged)
closed via merge request !114 (merged)
- Ondřej Surý mentioned in commit 7daf9ecc
mentioned in commit 7daf9ecc