tarantool / tarantool-qa

QA related issues of Tarantool
3 stars 0 forks source link

asan: leak at src/lib/bitset/iterator.c:146 #2

Open avtikhon opened 4 years ago

avtikhon commented 4 years ago

Tarantool version: 2.6.0

OS version: All

Bug description: Currently LSAN disabled with: asan/lsan.supp

# test: box/bitset.test.lua
# source: src/lib/bitset/iterator.c
leak:tt_bitset_iterator_init

Disabling suppression got issue:

root@272af6f672b2:/source# cat /source/test/var/001_box/box.log
==6253==AddressSanitizer: libc interceptors initialized
|| `[0x10007fff8000, 0x7fffffffffff]` || HighMem    ||
|| `[0x02008fff7000, 0x10007fff7fff]` || HighShadow ||
|| `[0x00008fff7000, 0x02008fff6fff]` || ShadowGap  ||
|| `[0x00007fff8000, 0x00008fff6fff]` || LowShadow  ||
|| `[0x000000000000, 0x00007fff7fff]` || LowMem     ||
MemToShadow(shadow): 0x00008fff7000 0x000091ff6dff 0x004091ff6e00 0x02008fff6fff
redzone=16
max_redzone=2048
quarantine_size_mb=256M
thread_local_quarantine_size_kb=1024K
malloc_context_size=30
SHADOW_SCALE: 3
SHADOW_GRANULARITY: 8
SHADOW_OFFSET: 0x7fff8000
==6253==Installed the sigaction for signal 11
==6253==Installed the sigaction for signal 7
==6253==Installed the sigaction for signal 8
==6253==SetCurrentThread: 0x7f4d60148000 for thread 0x7f4d60156bc0
==6253==T0: stack [0x7ffc8c6e6000,0x7ffc8cee6000) size 0x800000; local=0x7ffc8cee4674
AddressSanitizer: reading suppressions file at /source/asan/lsan.supp
==6253==Using llvm-symbolizer found at: /usr/bin/llvm-symbolizer-8
==6253==AddressSanitizer Init done
==6253==SetCurrentThread: 0x7f4d601480a0 for thread 0x7f4d5c7ff700
==6253==T1: stack [0x7f4d5c000000,0x7f4d5c7f7b40) size 0x7f7b40; local=0x7f4d5c7f7a34
Starting instance box...
Run console at unix/:/source/test/var/001_box/box.control
started
mkdir /source/test/var/001_box/box
2020-07-21 05:34:38.824 [6253] main/103/box C> Tarantool 2.6.0-0-g47aa4e01e
2020-07-21 05:34:38.824 [6253] main/103/box C> log level 5
2020-07-21 05:34:38.824 [6253] main/103/box I> mapping 117440512 bytes for memtx tuple arena...
2020-07-21 05:34:38.824 [6253] main/103/box I> mapping 134217728 bytes for vinyl tuple arena...
==6253==SetCurrentThread: 0x7f4d60148140 for thread 0x7f4d4bfff700
==6253==T2: stack [0x7f4d4b800000,0x7f4d4bff7b40) size 0x7f7b40; local=0x7f4d4bff7a34
==6253==SetCurrentThread: 0x7f4d601481e0 for thread 0x7f4d4b7fe700
==6253==T3: stack [0x7f4d4afff000,0x7f4d4b7f6b40) size 0x7f7b40; local=0x7f4d4b7f6a34
2020-07-21 05:34:38.826 [6253] main/103/box I> instance uuid b9e36d35-b21b-4d5a-8127-01febae50800
2020-07-21 05:34:38.826 [6253] iproto/101/main I> binary: bound to unix/:(socket)
2020-07-21 05:34:38.826 [6253] main/103/box I> initializing an empty data directory
2020-07-21 05:34:38.842 [6253] main/103/box I> assigned id 1 to replica b9e36d35-b21b-4d5a-8127-01febae50800
2020-07-21 05:34:38.842 [6253] main/103/box I> cluster uuid 4c6bfb37-c573-4691-adb1-5dc94af37220
==6253==SetCurrentThread: 0x7f4d60148280 for thread 0x7f4d4affd700
==6253==T4: stack [0x7f4d4a7fe000,0x7f4d4aff5b40) size 0x7f7b40; local=0x7f4d4aff5a34
2020-07-21 05:34:38.843 [6253] snapshot/101/main I> saving snapshot `/source/test/var/001_box/box/00000000000000000000.snap.inprogress'
2020-07-21 05:34:38.891 [6253] snapshot/101/main I> done
==6253==T4 TSDDtor
==6253==T4 exited
==6253==__tls_get_addr: DTLS_Destroy 0x7f4d4aff6300 0
Trying to unpoison memory region [0x7f4d4a082000, 0x7f4d4a100000)
2020-07-21 05:34:38.893 [6253] main/103/box I> ready to accept requests
2020-07-21 05:34:38.893 [6253] main/103/box I> set 'log_level' configuration option to 5
2020-07-21 05:34:38.893 [6253] main/106/checkpoint_daemon I> scheduled next checkpoint for Tue Jul 21 07:32:11 2020
2020-07-21 05:34:38.894 [6253] main/103/box I> set 'memtx_memory' configuration option to 107374182
2020-07-21 05:34:38.894 [6253] main/103/box I> set 'listen' configuration option to "\/source\/test\/var\/001_box\/box.socket-iproto"
2020-07-21 05:34:38.895 [6253] main/103/box I> set 'log_format' configuration option to "plain"
2020-07-21 05:34:38.896 [6253] main/117/console/unix/:/source/test/var/001_box/box.socket-admin I> started
2020-07-21 05:34:38.896 [6253] main C> entering the event loop
2020-07-21 05:34:39.041 [6253] main C> got signal 15 - Terminated
==6253==T1 TSDDtor
==6253==T1 exited
==6253==T2 TSDDtor
==6253==__tls_get_addr: DTLS_Destroy 0x7f4d5c7f8300 0
==6253==T2 exited
==6253==__tls_get_addr: DTLS_Destroy 0x7f4d4bff8300 0
==6253==T3 TSDDtor
==6253==T3 exited
==6253==__tls_get_addr: DTLS_Destroy 0x7f4d4b7f7300 0
Trying to unpoison memory region [0x7f4d5b082000, 0x7f4d5b100000)
==6261==Attached to thread 6253.
==6261==Detached from thread 6253.

=================================================================
==6253==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 2304 byte(s) in 12 object(s) allocated from:
    #0 0x52101f in realloc (/source/src/tarantool+0x52101f)
    tarantool/tarantool#1 0xa2e58f in tt_bitset_iterator_init /source/src/lib/bitset/iterator.c:192:14
    tarantool/tarantool#2 0x96c2a3 in memtx_bitset_index_create_iterator /source/src/box/memtx_bitset.c:394:6
    tarantool/tarantool#3 0x55f6bc in index_create_iterator(index*, iterator_type, char const*, unsigned int) /source/src/box/index.h:637:9
    tarantool/tarantool#4 0x55f6bc in box_index_iterator /source/src/box/index.cc:379
    tarantool/tarantool#5 0x2ac0a867  (<unknown module>)

Direct leak of 2304 byte(s) in 12 object(s) allocated from:
    #0 0x52101f in realloc (/source/src/tarantool+0x52101f)
    tarantool/tarantool#1 0xa2e614 in tt_bitset_iterator_init /source/src/lib/bitset/iterator.c:200:18
    tarantool/tarantool#2 0x96c2a3 in memtx_bitset_index_create_iterator /source/src/box/memtx_bitset.c:394:6
    tarantool/tarantool#3 0x55f6bc in index_create_iterator(index*, iterator_type, char const*, unsigned int) /source/src/box/index.h:637:9
    tarantool/tarantool#4 0x55f6bc in box_index_iterator /source/src/box/index.cc:379
    tarantool/tarantool#5 0x2ac0a867  (<unknown module>)

Direct leak of 1152 byte(s) in 12 object(s) allocated from:
    #0 0x52101f in realloc (/source/src/tarantool+0x52101f)
    tarantool/tarantool#1 0xa2e72e in tt_bitset_iterator_reserve /source/src/lib/bitset/iterator.c:113:4
    tarantool/tarantool#2 0xa2e72e in tt_bitset_iterator_init /source/src/lib/bitset/iterator.c:207
    tarantool/tarantool#3 0x96c2a3 in memtx_bitset_index_create_iterator /source/src/box/memtx_bitset.c:394:6
    tarantool/tarantool#4 0x55f6bc in index_create_iterator(index*, iterator_type, char const*, unsigned int) /source/src/box/index.h:637:9
    tarantool/tarantool#5 0x55f6bc in box_index_iterator /source/src/box/index.cc:379
    tarantool/tarantool#6 0x2ac0a867  (<unknown module>)

Direct leak of 960 byte(s) in 5 object(s) allocated from:
    #0 0x52101f in realloc (/source/src/tarantool+0x52101f)
    tarantool/tarantool#1 0xa2e58f in tt_bitset_iterator_init /source/src/lib/bitset/iterator.c:192:14
    tarantool/tarantool#2 0x96c2a3 in memtx_bitset_index_create_iterator /source/src/box/memtx_bitset.c:394:6
    tarantool/tarantool#3 0x55f6bc in index_create_iterator(index*, iterator_type, char const*, unsigned int) /source/src/box/index.h:637:9
    tarantool/tarantool#4 0x55f6bc in box_index_iterator /source/src/box/index.cc:379
    tarantool/tarantool#5 0x2ac052e7  (<unknown module>)

Direct leak of 960 byte(s) in 5 object(s) allocated from:
    #0 0x52101f in realloc (/source/src/tarantool+0x52101f)
    tarantool/tarantool#1 0xa2e614 in tt_bitset_iterator_init /source/src/lib/bitset/iterator.c:200:18
    tarantool/tarantool#2 0x96c2a3 in memtx_bitset_index_create_iterator /source/src/box/memtx_bitset.c:394:6
    tarantool/tarantool#3 0x55f6bc in index_create_iterator(index*, iterator_type, char const*, unsigned int) /source/src/box/index.h:637:9
    tarantool/tarantool#4 0x55f6bc in box_index_iterator /source/src/box/index.cc:379
    tarantool/tarantool#5 0x2ac052e7  (<unknown module>)

Direct leak of 864 byte(s) in 4 object(s) allocated from:
    #0 0x52101f in realloc (/source/src/tarantool+0x52101f)
    tarantool/tarantool#1 0xa2e72e in tt_bitset_iterator_reserve /source/src/lib/bitset/iterator.c:113:4
    tarantool/tarantool#2 0xa2e72e in tt_bitset_iterator_init /source/src/lib/bitset/iterator.c:207
    tarantool/tarantool#3 0x96c2a3 in memtx_bitset_index_create_iterator /source/src/box/memtx_bitset.c:394:6
    tarantool/tarantool#4 0x55f6bc in index_create_iterator(index*, iterator_type, char const*, unsigned int) /source/src/box/index.h:637:9
    tarantool/tarantool#5 0x55f6bc in box_index_iterator /source/src/box/index.cc:379
    tarantool/tarantool#6 0x2ac052e7  (<unknown module>)

Direct leak of 576 byte(s) in 3 object(s) allocated from:
    #0 0x52101f in realloc (/source/src/tarantool+0x52101f)
    tarantool/tarantool#1 0xa2e58f in tt_bitset_iterator_init /source/src/lib/bitset/iterator.c:192:14
    tarantool/tarantool#2 0x96c2a3 in memtx_bitset_index_create_iterator /source/src/box/memtx_bitset.c:394:6
    tarantool/tarantool#3 0x55f6bc in index_create_iterator(index*, iterator_type, char const*, unsigned int) /source/src/box/index.h:637:9
    tarantool/tarantool#4 0x55f6bc in box_index_iterator /source/src/box/index.cc:379
    tarantool/tarantool#5 0x2ac0856a  (<unknown module>)

Direct leak of 576 byte(s) in 3 object(s) allocated from:
    #0 0x52101f in realloc (/source/src/tarantool+0x52101f)
    tarantool/tarantool#1 0xa2e614 in tt_bitset_iterator_init /source/src/lib/bitset/iterator.c:200:18
    tarantool/tarantool#2 0x96c2a3 in memtx_bitset_index_create_iterator /source/src/box/memtx_bitset.c:394:6
    tarantool/tarantool#3 0x55f6bc in index_create_iterator(index*, iterator_type, char const*, unsigned int) /source/src/box/index.h:637:9
    tarantool/tarantool#4 0x55f6bc in box_index_iterator /source/src/box/index.cc:379
    tarantool/tarantool#5 0x2ac0856a  (<unknown module>)

Direct leak of 288 byte(s) in 3 object(s) allocated from:
    #0 0x52101f in realloc (/source/src/tarantool+0x52101f)
    tarantool/tarantool#1 0xa2e72e in tt_bitset_iterator_reserve /source/src/lib/bitset/iterator.c:113:4
    tarantool/tarantool#2 0xa2e72e in tt_bitset_iterator_init /source/src/lib/bitset/iterator.c:207
    tarantool/tarantool#3 0x96c2a3 in memtx_bitset_index_create_iterator /source/src/box/memtx_bitset.c:394:6
    tarantool/tarantool#4 0x55f6bc in index_create_iterator(index*, iterator_type, char const*, unsigned int) /source/src/box/index.h:637:9
    tarantool/tarantool#5 0x55f6bc in box_index_iterator /source/src/box/index.cc:379
    tarantool/tarantool#6 0x2ac0856a  (<unknown module>)

Direct leak of 192 byte(s) in 1 object(s) allocated from:
    #0 0x52101f in realloc (/source/src/tarantool+0x52101f)
    tarantool/tarantool#1 0xa2e58f in tt_bitset_iterator_init /source/src/lib/bitset/iterator.c:192:14
    tarantool/tarantool#2 0x96c2a3 in memtx_bitset_index_create_iterator /source/src/box/memtx_bitset.c:394:6
    tarantool/tarantool#3 0x55f6bc in index_create_iterator(index*, iterator_type, char const*, unsigned int) /source/src/box/index.h:637:9
    tarantool/tarantool#4 0x55f6bc in box_index_iterator /source/src/box/index.cc:379
    tarantool/tarantool#5 0x2ac0705b  (<unknown module>)

Direct leak of 192 byte(s) in 1 object(s) allocated from:
    #0 0x52101f in realloc (/source/src/tarantool+0x52101f)
    tarantool/tarantool#1 0xa2e614 in tt_bitset_iterator_init /source/src/lib/bitset/iterator.c:200:18
    tarantool/tarantool#2 0x96c2a3 in memtx_bitset_index_create_iterator /source/src/box/memtx_bitset.c:394:6
    tarantool/tarantool#3 0x55f6bc in index_create_iterator(index*, iterator_type, char const*, unsigned int) /source/src/box/index.h:637:9
    tarantool/tarantool#4 0x55f6bc in box_index_iterator /source/src/box/index.cc:379
    tarantool/tarantool#5 0x2ac0705b  (<unknown module>)

Direct leak of 96 byte(s) in 1 object(s) allocated from:
    #0 0x52101f in realloc (/source/src/tarantool+0x52101f)
    tarantool/tarantool#1 0xa2e72e in tt_bitset_iterator_reserve /source/src/lib/bitset/iterator.c:113:4
    tarantool/tarantool#2 0xa2e72e in tt_bitset_iterator_init /source/src/lib/bitset/iterator.c:207
    tarantool/tarantool#3 0x96c2a3 in memtx_bitset_index_create_iterator /source/src/box/memtx_bitset.c:394:6
    tarantool/tarantool#4 0x55f6bc in index_create_iterator(index*, iterator_type, char const*, unsigned int) /source/src/box/index.h:637:9
    tarantool/tarantool#5 0x55f6bc in box_index_iterator /source/src/box/index.cc:379
    tarantool/tarantool#6 0x2ac0705b  (<unknown module>)

Indirect leak of 3072 byte(s) in 12 object(s) allocated from:
    #0 0x52101f in realloc (/source/src/tarantool+0x52101f)
    tarantool/tarantool#1 0xa2ea39 in tt_bitset_iterator_conj_reserve /source/src/lib/bitset/iterator.c:150:34
    tarantool/tarantool#2 0xa2ea39 in tt_bitset_iterator_init /source/src/lib/bitset/iterator.c:215
    tarantool/tarantool#3 0x96c2a3 in memtx_bitset_index_create_iterator /source/src/box/memtx_bitset.c:394:6
    tarantool/tarantool#4 0x55f6bc in index_create_iterator(index*, iterator_type, char const*, unsigned int) /source/src/box/index.h:637:9
    tarantool/tarantool#5 0x55f6bc in box_index_iterator /source/src/box/index.cc:379
    tarantool/tarantool#6 0x2ac0a867  (<unknown module>)

Indirect leak of 3072 byte(s) in 12 object(s) allocated from:
    #0 0x52101f in realloc (/source/src/tarantool+0x52101f)
    tarantool/tarantool#1 0xa2e96b in tt_bitset_iterator_conj_reserve /source/src/lib/bitset/iterator.c:142:31
    tarantool/tarantool#2 0xa2e96b in tt_bitset_iterator_init /source/src/lib/bitset/iterator.c:215
    tarantool/tarantool#3 0x96c2a3 in memtx_bitset_index_create_iterator /source/src/box/memtx_bitset.c:394:6
    tarantool/tarantool#4 0x55f6bc in index_create_iterator(index*, iterator_type, char const*, unsigned int) /source/src/box/index.h:637:9
    tarantool/tarantool#5 0x55f6bc in box_index_iterator /source/src/box/index.cc:379
    tarantool/tarantool#6 0x2ac0a867  (<unknown module>)

Indirect leak of 2816 byte(s) in 11 object(s) allocated from:
    #0 0x52101f in realloc (/source/src/tarantool+0x52101f)
    tarantool/tarantool#1 0xa2ea39 in tt_bitset_iterator_conj_reserve /source/src/lib/bitset/iterator.c:150:34
    tarantool/tarantool#2 0xa2ea39 in tt_bitset_iterator_init /source/src/lib/bitset/iterator.c:215
    tarantool/tarantool#3 0x96c2a3 in memtx_bitset_index_create_iterator /source/src/box/memtx_bitset.c:394:6
    tarantool/tarantool#4 0x55f6bc in index_create_iterator(index*, iterator_type, char const*, unsigned int) /source/src/box/index.h:637:9
    tarantool/tarantool#5 0x55f6bc in box_index_iterator /source/src/box/index.cc:379
    tarantool/tarantool#6 0x2ac052e7  (<unknown module>)

Indirect leak of 2816 byte(s) in 11 object(s) allocated from:
    #0 0x52101f in realloc (/source/src/tarantool+0x52101f)
    tarantool/tarantool#1 0xa2e96b in tt_bitset_iterator_conj_reserve /source/src/lib/bitset/iterator.c:142:31
    tarantool/tarantool#2 0xa2e96b in tt_bitset_iterator_init /source/src/lib/bitset/iterator.c:215
    tarantool/tarantool#3 0x96c2a3 in memtx_bitset_index_create_iterator /source/src/box/memtx_bitset.c:394:6
    tarantool/tarantool#4 0x55f6bc in index_create_iterator(index*, iterator_type, char const*, unsigned int) /source/src/box/index.h:637:9
    tarantool/tarantool#5 0x55f6bc in box_index_iterator /source/src/box/index.cc:379
    tarantool/tarantool#6 0x2ac052e7  (<unknown module>)

Indirect leak of 1024 byte(s) in 3 object(s) allocated from:
    #0 0x52101f in realloc (/source/src/tarantool+0x52101f)
    tarantool/tarantool#1 0xa2e96b in tt_bitset_iterator_conj_reserve /source/src/lib/bitset/iterator.c:142:31
    tarantool/tarantool#2 0xa2e96b in tt_bitset_iterator_init /source/src/lib/bitset/iterator.c:215
    tarantool/tarantool#3 0x96c2a3 in memtx_bitset_index_create_iterator /source/src/box/memtx_bitset.c:394:6
    tarantool/tarantool#4 0x55f6bc in index_create_iterator(index*, iterator_type, char const*, unsigned int) /source/src/box/index.h:637:9
    tarantool/tarantool#5 0x55f6bc in box_index_iterator /source/src/box/index.cc:379
    tarantool/tarantool#6 0x2ac0856a  (<unknown module>)

Indirect leak of 1024 byte(s) in 3 object(s) allocated from:
    #0 0x52101f in realloc (/source/src/tarantool+0x52101f)
    tarantool/tarantool#1 0xa2ea39 in tt_bitset_iterator_conj_reserve /source/src/lib/bitset/iterator.c:150:34
    tarantool/tarantool#2 0xa2ea39 in tt_bitset_iterator_init /source/src/lib/bitset/iterator.c:215
    tarantool/tarantool#3 0x96c2a3 in memtx_bitset_index_create_iterator /source/src/box/memtx_bitset.c:394:6
    tarantool/tarantool#4 0x55f6bc in index_create_iterator(index*, iterator_type, char const*, unsigned int) /source/src/box/index.h:637:9
    tarantool/tarantool#5 0x55f6bc in box_index_iterator /source/src/box/index.cc:379
    tarantool/tarantool#6 0x2ac0856a  (<unknown module>)

Indirect leak of 512 byte(s) in 1 object(s) allocated from:
    #0 0x52101f in realloc (/source/src/tarantool+0x52101f)
    tarantool/tarantool#1 0xa2ea39 in tt_bitset_iterator_conj_reserve /source/src/lib/bitset/iterator.c:150:34
    tarantool/tarantool#2 0xa2ea39 in tt_bitset_iterator_init /source/src/lib/bitset/iterator.c:215
    tarantool/tarantool#3 0x96c2a3 in memtx_bitset_index_create_iterator /source/src/box/memtx_bitset.c:394:6
    tarantool/tarantool#4 0x55f6bc in index_create_iterator(index*, iterator_type, char const*, unsigned int) /source/src/box/index.h:637:9
    tarantool/tarantool#5 0x55f6bc in box_index_iterator /source/src/box/index.cc:379
    tarantool/tarantool#6 0x2ac0705b  (<unknown module>)

Indirect leak of 512 byte(s) in 1 object(s) allocated from:
    #0 0x52101f in realloc (/source/src/tarantool+0x52101f)
    tarantool/tarantool#1 0xa2e96b in tt_bitset_iterator_conj_reserve /source/src/lib/bitset/iterator.c:142:31
    tarantool/tarantool#2 0xa2e96b in tt_bitset_iterator_init /source/src/lib/bitset/iterator.c:215
    tarantool/tarantool#3 0x96c2a3 in memtx_bitset_index_create_iterator /source/src/box/memtx_bitset.c:394:6
    tarantool/tarantool#4 0x55f6bc in index_create_iterator(index*, iterator_type, char const*, unsigned int) /source/src/box/index.h:637:9
    tarantool/tarantool#5 0x55f6bc in box_index_iterator /source/src/box/index.cc:379
    tarantool/tarantool#6 0x2ac0705b  (<unknown module>)

Indirect leak of 384 byte(s) in 12 object(s) allocated from:
    #0 0x52101f in realloc (/source/src/tarantool+0x52101f)
    tarantool/tarantool#1 0xa2e9d6 in tt_bitset_iterator_conj_reserve /source/src/lib/bitset/iterator.c:146:19
    tarantool/tarantool#2 0xa2e9d6 in tt_bitset_iterator_init /source/src/lib/bitset/iterator.c:215
    tarantool/tarantool#3 0x96c2a3 in memtx_bitset_index_create_iterator /source/src/box/memtx_bitset.c:394:6
    tarantool/tarantool#4 0x55f6bc in index_create_iterator(index*, iterator_type, char const*, unsigned int) /source/src/box/index.h:637:9
    tarantool/tarantool#5 0x55f6bc in box_index_iterator /source/src/box/index.cc:379
    tarantool/tarantool#6 0x2ac0a867  (<unknown module>)

Indirect leak of 352 byte(s) in 11 object(s) allocated from:
    #0 0x52101f in realloc (/source/src/tarantool+0x52101f)
    tarantool/tarantool#1 0xa2e9d6 in tt_bitset_iterator_conj_reserve /source/src/lib/bitset/iterator.c:146:19
    tarantool/tarantool#2 0xa2e9d6 in tt_bitset_iterator_init /source/src/lib/bitset/iterator.c:215
    tarantool/tarantool#3 0x96c2a3 in memtx_bitset_index_create_iterator /source/src/box/memtx_bitset.c:394:6
    tarantool/tarantool#4 0x55f6bc in index_create_iterator(index*, iterator_type, char const*, unsigned int) /source/src/box/index.h:637:9
    tarantool/tarantool#5 0x55f6bc in box_index_iterator /source/src/box/index.cc:379
    tarantool/tarantool#6 0x2ac052e7  (<unknown module>)

Indirect leak of 128 byte(s) in 3 object(s) allocated from:
    #0 0x52101f in realloc (/source/src/tarantool+0x52101f)
    tarantool/tarantool#1 0xa2e9d6 in tt_bitset_iterator_conj_reserve /source/src/lib/bitset/iterator.c:146:19
    tarantool/tarantool#2 0xa2e9d6 in tt_bitset_iterator_init /source/src/lib/bitset/iterator.c:215
    tarantool/tarantool#3 0x96c2a3 in memtx_bitset_index_create_iterator /source/src/box/memtx_bitset.c:394:6
    tarantool/tarantool#4 0x55f6bc in index_create_iterator(index*, iterator_type, char const*, unsigned int) /source/src/box/index.h:637:9
    tarantool/tarantool#5 0x55f6bc in box_index_iterator /source/src/box/index.cc:379
    tarantool/tarantool#6 0x2ac0856a  (<unknown module>)

Indirect leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x52101f in realloc (/source/src/tarantool+0x52101f)
    tarantool/tarantool#1 0xa2e9d6 in tt_bitset_iterator_conj_reserve /source/src/lib/bitset/iterator.c:146:19
    tarantool/tarantool#2 0xa2e9d6 in tt_bitset_iterator_init /source/src/lib/bitset/iterator.c:215
    tarantool/tarantool#3 0x96c2a3 in memtx_bitset_index_create_iterator /source/src/box/memtx_bitset.c:394:6
    tarantool/tarantool#4 0x55f6bc in index_create_iterator(index*, iterator_type, char const*, unsigned int) /source/src/box/index.h:637:9
    tarantool/tarantool#5 0x55f6bc in box_index_iterator /source/src/box/index.cc:379
    tarantool/tarantool#6 0x2ac0705b  (<unknown module>)

SUMMARY: AddressSanitizer: 26240 byte(s) leaked in 143 allocation(s).

Steps to reproduce:

  1. Start the 'debian-buster' image and run the following instructions in it:
    docker run --network=host -v $PWD:/source -w /source -ti registry.gitlab.com/tarantool/tarantool/testing/debian-buster
  2. Build with ASAN:
    make -f .travis.mk test_asan_debian
  3. Block suppression at LSAN table list:

    diff --git a/asan/lsan.supp b/asan/lsan.supp
    index 3273c3baf..224e88019 100644
    --- a/asan/lsan.supp
    +++ b/asan/lsan.supp
    @@ -38,7 +38,7 @@ leak:AccessDeniedError::AccessDeniedError
    
    # test: box/bitset.test.lua
    # source: src/lib/bitset/iterator.c
    -leak:tt_bitset_iterator_init
    +#leak:tt_bitset_iterator_init
    
    # test: box-py/args.test.py
    # source: /lib/x86_64-linux-gnu/libc.so*
  4. Create reproducer 'box/bitset_gh-5188.test.lua' in 'test' directory:
    -- value '50' can be changed to '5' to avoid of issue and to '500' to get the issue more frequently
    s = box.schema.space.create('test')
    _ = s:create_index('primary', { type = 'hash', parts = {1, 'unsigned'}, unique = true })
    i = s:create_index('bitset', { type = 'bitset', parts = {2, 'unsigned'}, unique = false })
    for n = 1, 50, 1 do \
    i:pairs(7, {iterator = box.index.BITS_ANY_SET}) \
    end
    s:drop()
    s = nil
  5. Update result for the new test file:
    cd test
    export ASAN_OPTIONS=heap_profile=0:unmap_shadow_on_exit=1:detect_invalid_pointer_pairs=1:symbolize=1:detect_leaks=1:dump_instruction_bytes=1:print_suppressions=0:verbosity=9 ; export LSAN_OPTIONS=suppressions=/source/asan/lsan.supp ; ./test-run.py box/bitset_gh-5188.test.lua --update-result
  6. Run a few times till the issue appears:
    export ASAN_OPTIONS=heap_profile=0:unmap_shadow_on_exit=1:detect_invalid_pointer_pairs=1:symbolize=1:detect_leaks=1:dump_instruction_bytes=1:print_suppressions=0:verbosity=9 ; export LSAN_OPTIONS=suppressions=/source/asan/lsan.supp ; ./test-run.py --force box/bitset_gh-5188.test.lua
  7. Check the log:
    less var/001_box/box.log
  8. Found that function 'src/lib/bitset/iterator.c:tt_bitset_iterator_init' used 49 times, when LSAN showed the issue, and 50 times when didn't, also didn't use 'src/lib/bitset/iterator.c:tt_bitset_iterator_destroy' in both variants.
  9. Found that 'count' instead of 'pairs' didn't show any memory leaks, also src/lib/bitset/iterator.c:tt_bitset_iterator_destroy used the same as 'src/lib/bitset/iterator.c:tt_bitset_iterator_init' 50 times.

Optional (but very desirable):

igormunkin commented 3 years ago

@avtikhon, I glanced the issue description and strongly doubt this one relates to LuaJIT, since I see no LuaJIT routines in backtraces reported by sanitizer. The problem might relate to some Lua code in Tarantool, but I still suggest replacing luajit label with the corresponding one.

Totktonada commented 3 years ago

@avtikhon If you'll create a docker/test-run free reproducer, I guess it will be enough to file an issue against the development team.