Skip to content

AddressSanitizer: heap-use-after-free in DateLUTImpl (test_shutdown_static_destructor_failure) #82059

@azat

Description

@azat
E           Exception: Sanitizer assert found for instance =================================================================
E           ==8==ERROR: AddressSanitizer: heap-use-after-free on address 0x7fca966ba7f0 at pc 0x56154c16ee48 bp 0x7fffa60c25e0 sp 0x7fffa60c25d8
E           READ of size 8 at 0x7fca966ba7f0 thread T0
E               #0 0x56154c16ee47 in DateLUTImpl::findIndex(long) const ci/tmp/build/./src/Common/DateLUTImpl.h:245:29
E               #1 0x56154c16ee47 in DateLUTImpl::toDateTimeComponents(long) const ci/tmp/build/./src/Common/DateLUTImpl.h:1263:32
E               #2 0x56154c16ee47 in LocalDateTime::init(long, DateLUTImpl const&) ci/tmp/build/./src/Common/LocalDateTime.cpp:6:60
E               #3 0x56156187dd8b in LocalDateTime::LocalDateTime(long, DateLUTImpl const&) ci/tmp/build/./src/Common/LocalDateTime.h:51:9
E               #4 0x56156187dd8b in void DB::writeDateTimeText<(char)46, (char)58, (char)32>(long, DB::WriteBuffer&, DateLUTImpl const&) ci/tmp/build/./src/IO/WriteHelpers.h:906:84
E               #5 0x56156187dd8b in OwnPatternFormatter::formatExtended(DB::ExtendedLogMessage const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>&) const ci/tmp/build/./src/Loggers/OwnPatternFormatter.cpp:23:5
E               #6 0x5615618765f3 in DB::OwnFormattingChannel::logExtended(DB::ExtendedLogMessage const&) ci/tmp/build/./src/Loggers/OwnFormattingChannel.cpp:15:25
E               #7 0x56156187fb4b in DB::OwnSplitChannel::logSplit(DB::ExtendedLogMessage const&, std::__1::shared_ptr<DB::InternalTextLogsQueue> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) ci/tmp/build/./src/Loggers/OwnSplitChannel.cpp:124:33
E               #8 0x56156187f20e in DB::OwnSplitChannel::log(Poco::Message const&) ci/tmp/build/./src/Loggers/OwnSplitChannel.cpp:42:5
E               #9 0x56154bb49025 in DB::tryLogCurrentExceptionImpl(Poco::Logger*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, DB::LogsLevel) ci/tmp/build/./src/Common/Exception.cpp:308:36
E               #10 0x56154bb47b6a in DB::tryLogCurrentException(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, DB::LogsLevel) ci/tmp/build/./src/Common/Exception.cpp:342:5
E               #11 0x561555afff59 in HandledSignals::~HandledSignals() ci/tmp/build/./src/Common/SignalHandlers.cpp:666:9
E               #12 0x7fca9a63c494  (/lib/x86_64-linux-gnu/libc.so.6+0x45494) (BuildId: d5197096f709801829b118af1b7cf6631efa2dcd)
E               #13 0x7fca9a63c60f in exit (/lib/x86_64-linux-gnu/libc.so.6+0x4560f) (BuildId: d5197096f709801829b118af1b7cf6631efa2dcd)
E               #14 0x7fca9a620d96  (/lib/x86_64-linux-gnu/libc.so.6+0x29d96) (BuildId: d5197096f709801829b118af1b7cf6631efa2dcd)
E               #15 0x7fca9a620e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f) (BuildId: d5197096f709801829b118af1b7cf6631efa2dcd)
E               #16 0x56153b21a02d in _start (/usr/bin/clickhouse+0xc45e02d) (BuildId: 2f363f26e85b6e1fa25b52af71220a5a39aa3e3d)
E           
E           0x7fca966ba7f0 is located 733168 bytes inside of 4695984-byte region [0x7fca96607800,0x7fca96a81fb0)
E           freed by thread T0 here:
E               #0 0x56153b2ee622 in operator delete(void*, unsigned long) (/usr/bin/clickhouse+0xc532622) (BuildId: 2f363f26e85b6e1fa25b52af71220a5a39aa3e3d)
E               #1 0x56154bb06e8a in std::__1::default_delete<DateLUTImpl>::operator()[abi:ne190107](DateLUTImpl*) const ci/tmp/build/./contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:80:5
E               #2 0x56154bb06e8a in std::__1::unique_ptr<DateLUTImpl, std::__1::default_delete<DateLUTImpl>>::reset[abi:ne190107](DateLUTImpl*) ci/tmp/build/./contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:292:7
E               #3 0x56154bb06e8a in std::__1::unique_ptr<DateLUTImpl, std::__1::default_delete<DateLUTImpl>>::~unique_ptr[abi:ne190107]() ci/tmp/build/./contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:261:71
E               #4 0x56154bb06e8a in std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, std::__1::unique_ptr<DateLUTImpl, std::__1::default_delete<DateLUTImpl>>>::~pair() ci/tmp/build/./contrib/llvm-project/libcxx/include/__utility/pair.h:65:29
E               #5 0x56154bb06e8a in void std::__1::__destroy_at[abi:ne190107]<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, std::__1::unique_ptr<DateLUTImpl, std::__1::default_delete<DateLUTImpl>>>, 0>(std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, std::__1::unique_ptr<DateLUTImpl, std::__1::default_delete<DateLUTImpl>>>*) ci/tmp/build/./contrib/llvm-project/libcxx/include/__memory/construct_at.h:67:11
E               #6 0x56154bb06e8a in void std::__1::allocator_traits<std::__1::allocator<std::__1::__hash_node<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<DateLUTImpl, std::__1::default_delete<DateLUTImpl>>>, void*>>>::destroy[abi:ne190107]<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, std::__1::unique_ptr<DateLUTImpl, std::__1::default_delete<DateLUTImpl>>>, void, 0>(std::__1::allocator<std::__1::__hash_node<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<DateLUTImpl, std::__1::default_delete<DateLUTImpl>>>, void*>>&, std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, std::__1::unique_ptr<DateLUTImpl, std::__1::default_delete<DateLUTImpl>>>*) ci/tmp/build/./contrib/llvm-project/libcxx/include/__memory/allocator_traits.h:339:5
E               #7 0x56154bb06e8a in std::__1::__hash_table<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<DateLUTImpl, std::__1::default_delete<DateLUTImpl>>>, std::__1::__unordered_map_hasher<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<DateLUTImpl, std::__1::default_delete<DateLUTImpl>>>, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, true>, std::__1::__unordered_map_equal<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<DateLUTImpl, std::__1::default_delete<DateLUTImpl>>>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, true>, std::__1::allocator<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<DateLUTImpl, std::__1::default_delete<DateLUTImpl>>>>>::__deallocate_node(std::__1::__hash_node_base<std::__1::__hash_node<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<DateLUTImpl, std::__1::default_delete<DateLUTImpl>>>, void*>*>*) ci/tmp/build/./contrib/llvm-project/libcxx/include/__hash_table:1139:5
E               #8 0x56154bb06e8a in std::__1::__hash_table<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<DateLUTImpl, std::__1::default_delete<DateLUTImpl>>>, std::__1::__unordered_map_hasher<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<DateLUTImpl, std::__1::default_delete<DateLUTImpl>>>, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, true>, std::__1::__unordered_map_equal<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<DateLUTImpl, std::__1::default_delete<DateLUTImpl>>>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, true>, std::__1::allocator<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<DateLUTImpl, std::__1::default_delete<DateLUTImpl>>>>>::~__hash_table() ci/tmp/build/./contrib/llvm-project/libcxx/include/__hash_table:1107:3
E               #9 0x7fca9a63c494  (/lib/x86_64-linux-gnu/libc.so.6+0x45494) (BuildId: d5197096f709801829b118af1b7cf6631efa2dcd)
E           
E           previously allocated by thread T0 here:
E               #0 0x56153b2ed9bd in operator new(unsigned long) (/usr/bin/clickhouse+0xc5319bd) (BuildId: 2f363f26e85b6e1fa25b52af71220a5a39aa3e3d)
E               #1 0x56154bb01d7a in DateLUT::getImplementation(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) const ci/tmp/build/./src/Common/DateLUT.cpp:196:51
E               #2 0x56154bb042e6 in DateLUT::DateLUT() ci/tmp/build/./src/Common/DateLUT.cpp:186:25
E               #3 0x56154bb01c3a in DateLUT::getInstance() ci/tmp/build/./src/Common/DateLUT.cpp:203:20
E               #4 0x561555ad7791 in DateLUT::setDefaultTimezone(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) ci/tmp/build/./src/Common/DateLUT.h:45:27
E               #5 0x561555ad7791 in BaseDaemon::initialize(Poco::Util::Application&) ci/tmp/build/./src/Daemon/BaseDaemon.cpp:292:9
E               #6 0x56154c205cf3 in DB::Server::initialize(Poco::Util::Application&) ci/tmp/build/./programs/server/Server.cpp:600:17
E               #7 0x56156e3536c4 in Poco::Util::Application::run() ci/tmp/build/./base/poco/Util/src/Application.cpp:310:2
E               #8 0x56154c205919 in DB::Server::run() ci/tmp/build/./programs/server/Server.cpp:594:25
E               #9 0x56154c200818 in mainEntryClickHouseServer(int, char**) ci/tmp/build/./programs/server/Server.cpp:391:20
E               #10 0x56153b2f1e0b in main ci/tmp/build/./programs/main.cpp:321:21
E               #11 0x7fca9a620d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f) (BuildId: d5197096f709801829b118af1b7cf6631efa2dcd)
E           
E           SUMMARY: AddressSanitizer: heap-use-after-free ci/tmp/build/./src/Common/DateLUTImpl.h:245:29 in DateLUTImpl::findIndex(long) const
E           Shadow bytes around the buggy address:
E             0x7fca966ba500: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
E             0x7fca966ba580: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
E             0x7fca966ba600: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
E             0x7fca966ba680: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
E             0x7fca966ba700: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
E           =>0x7fca966ba780: fd fd fd fd fd fd fd fd fd fd fd fd fd fd[fd]fd
E             0x7fca966ba800: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
E             0x7fca966ba880: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
E             0x7fca966ba900: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
E             0x7fca966ba980: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
E             0x7fca966baa00: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
E           Shadow byte legend (one shadow byte represents 8 application bytes):
E             Addressable:           00
E             Partially addressable: 01 02 03 04 05 06 07 
E             Heap left redzone:       fa
E             Freed heap region:       fd
E             Stack left redzone:      f1
E             Stack mid redzone:       f2
E             Stack right redzone:     f3
E             Stack after return:      f5
E             Stack use after scope:   f8
E             Global redzone:          f9
E             Global init order:       f6
E             Poisoned by user:        f7
E             Container overflow:      fc
E             Array cookie:            ac
E             Intra object redzone:    bb
E             ASan internal:           fe
E             Left alloca redzone:     ca
E             Right alloca redzone:    cb
E           ==8==ABORTING

https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=82034&sha=7a4b56f9571d8adf921cafb10067f0d359267e66&name_0=PR&name_1=Integration%20tests%20%28asan%2C%20old%20analyzer%2C%201%2F6%29

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions