https://s3.amazonaws.com/clickhouse-test-reports/0/8a2e006cc47c2b7e8294f551df180fe8bc3b2b13/stress_test__memory__actions_.html

There is interesting stacktrace:
```
Thread 1239 (Thread 0x7f619216d700 (LWP 50335)):
#0  0x000000000b5ca2a7 in __sanitizer::internal_sched_yield() ()
#1  0x000000000b5cb9e5 in __sanitizer::StaticSpinMutex::LockSlow() ()
#2  0x000000000b5d61dc in __sanitizer::StackDepotBase<__sanitizer::StackDepotNode, 1, 20>::Put(__sanitizer::StackTrace, bool*) ()
#3  0x000000000b5d5d57 in __sanitizer::StackDepotPut(__sanitizer::StackTrace) ()
#4  0x000000000b63db6e in __msan::PoisonMemory(void const*, unsigned long, __sanitizer::StackTrace*) ()
#5  0x000000000b5ee7a7 in __sanitizer_dtor_callback ()
#6  0x000000000b7b15ae in LockMemoryExceptionInThread::~LockMemoryExceptionInThread (this=0x7f6192161c20) at ../src/Common/LockMemoryExceptionInThread.cpp:20
#7  0x000000000b6cf878 in DB::WriteBuffer::finalize (this=0x7f6192162038) at ../src/IO/WriteBuffer.h:135
#8  0x000000000b7a2849 in DB::WriteBufferFromFileDescriptor::~WriteBufferFromFileDescriptor (this=0x7f6192162038) at ../src/IO/WriteBufferFromFileDescriptor.cpp:97
#9  0x0000000039390ad7 in sanitizerDeathCallback () at ../base/daemon/BaseDaemon.cpp:403
#10 0x000000000b5d1176 in __sanitizer::Die() ()
#11 0x000000000b5c221d in __sanitizer::ReportMmapFailureAndDie(unsigned long, char const*, char const*, int, bool) ()
#12 0x000000000b5cbb6a in __sanitizer::MmapOrDie(unsigned long, char const*, bool) ()
#13 0x000000000b5c52e8 in __sanitizer::ReadFileToBuffer(char const*, char**, unsigned long*, unsigned long*, unsigned long, int*) ()
#14 0x000000000b5cea14 in __sanitizer::ReadProcMaps(__sanitizer::ProcSelfMapsBuff*) ()
#15 0x000000000b5ce14a in __sanitizer::MemoryMappingLayout::MemoryMappingLayout(bool) ()
#16 0x000000000b5cc62d in __sanitizer::DumpProcessMap() ()
#17 0x000000000b5c21ef in __sanitizer::ReportMmapFailureAndDie(unsigned long, char const*, char const*, int, bool) ()
#18 0x000000000b5cbb6a in __sanitizer::MmapOrDie(unsigned long, char const*, bool) ()
#19 0x000000000b5c2d78 in __sanitizer::InternalMmapVectorNoCtor<char>::Realloc(unsigned long) ()
#20 0x000000000b5d7338 in __sanitizer::StackTrace::Print() const ()
#21 0x000000000b5d54a1 in __sanitizer::ScopedAllocatorErrorReport::~ScopedAllocatorErrorReport() ()
#22 0x000000000b5d5714 in __sanitizer::ReportOutOfMemory(unsigned long, __sanitizer::StackTrace const*) ()
#23 0x000000000b5e4b02 in __msan::MsanAllocate(__sanitizer::StackTrace*, unsigned long, unsigned long, bool) ()
#24 0x000000000b5e4916 in __msan::msan_malloc(unsigned long, __sanitizer::StackTrace*) ()
#25 0x000000000b5ee52f in malloc ()
#26 0x000000000b7a6c6c in Allocator<false, false>::allocNoTrack (this=<optimized out>, size=1048576, alignment=<optimized out>) at ../src/Common/Allocator.h:227
#27 0x000000000b830583 in Allocator<false, false>::alloc (this=0x704029904c68, alignment=0, size=<optimized out>) at ../src/Common/Allocator.h:96
#28 DB::PODArrayBase<1ul, 4096ul, Allocator<false, false>, 15ul, 16ul>::alloc<>(unsigned long) (this=0x704029904c68, bytes=<optimized out>) at ../src/Common/PODArray.h:128
#29 0x000000003a99c9f1 in DB::PODArrayBase<1ul, 4096ul, Allocator<false, false>, 15ul, 16ul>::realloc<>(unsigned long) (this=0x704029904c68, bytes=190620327) at ../src/Common/PODArray.h:153
#30 DB::PODArrayBase<1ul, 4096ul, Allocator<false, false>, 15ul, 16ul>::reserve<>(unsigned long) (this=0x704029904c68, n=<optimized out>) at ../src/Common/PODArray.h:234
#31 DB::SerializationString::deserializeBinaryBulk (this=<optimized out>, column=..., istr=..., limit=8192, avg_value_size_hint=<optimized out>) at ../src/DataTypes/Serializations/SerializationString.cpp:183
#32 0x000000003a8102dd in DB::ISerialization::deserializeBinaryBulkWithMultipleStreams (this=0x704029904c40, column=..., limit=8192, settings=..., cache=<optimized out>) at ../src/DataTypes/Serializations/ISerialization.cpp:132
#33 0x000000003fd2b1aa in DB::MergeTreeReaderWide::readData (this=this@entry=0x715000976800, name_and_type=..., column=..., from_mark=123351482093320, continue_reading=<optimized out>, current_task_last_mark=52096109260944, max_rows_to_read=<optimized out>, cache=..., was_prefetched=<optimized out>) at ../src/Storages/MergeTree/MergeTreeReaderWide.cpp:295
#34 0x000000003fd2827b in DB::MergeTreeReaderWide::readRows (this=0x715000976800, from_mark=<optimized out>, current_task_last_mark=<optimized out>, continue_reading=<optimized out>, max_rows_to_read=<optimized out>, res_columns=...) at ../src/Storages/MergeTree/MergeTreeReaderWide.cpp:120
#35 0x000000004134f6fc in DB::MergeTreeRangeReader::DelayedStream::readRows (this=0x715000e19450, columns=..., num_rows=8192) at ../src/Storages/MergeTree/MergeTreeRangeReader.cpp:90
#36 DB::MergeTreeRangeReader::DelayedStream::finalize (this=<optimized out>, this@entry=0x715000e19450, columns=...) at ../src/Storages/MergeTree/MergeTreeRangeReader.cpp:164
#37 0x000000004136189b in DB::MergeTreeRangeReader::Stream::finalize (this=0x715000e19420, columns=...) at ../src/Storages/MergeTree/MergeTreeRangeReader.cpp:275
#38 DB::MergeTreeRangeReader::startReadingChain (this=this@entry=0x715000e19400, max_rows=max_rows@entry=8192, ranges=...) at ../src/Storages/MergeTree/MergeTreeRangeReader.cpp:801
#39 0x000000004135b48c in DB::MergeTreeRangeReader::read (this=0x715000e19400, max_rows=6, ranges=...) at ../src/Storages/MergeTree/MergeTreeRangeReader.cpp:728
#40 0x000000004132d52f in DB::MergeTreeBaseSelectProcessor::readFromPartImpl (this=this@entry=0x719003181218) at ../src/Storages/MergeTree/MergeTreeBaseSelectProcessor.cpp:272
#41 0x0000000041330406 in DB::MergeTreeBaseSelectProcessor::readFromPart (this=0x719003181218) at ../src/Storages/MergeTree/MergeTreeBaseSelectProcessor.cpp:320
#42 0x000000004132a577 in DB::MergeTreeBaseSelectProcessor::generate (this=<optimized out>) at ../src/Storages/MergeTree/MergeTreeBaseSelectProcessor.cpp:183
#43 0x000000004072d28d in DB::ISource::tryGenerate (this=0x719003181218) at ../src/Processors/ISource.cpp:79
#44 0x000000004072cc52 in DB::ISource::work (this=0x719003181218) at ../src/Processors/ISource.cpp:53
#45 0x00000000410a9abd in DB::SourceWithProgress::work (this=0x719003181218) at ../src/Processors/Sources/SourceWithProgress.cpp:67
#46 0x000000004079fd1a in DB::executeJob (processor=0x719003181218) at ../src/Processors/Executors/ExecutionThreadContext.cpp:45
#47 DB::ExecutionThreadContext::executeTask (this=<optimized out>) at ../src/Processors/Executors/ExecutionThreadContext.cpp:68
#48 0x000000004076ad26 in DB::PipelineExecutor::executeStepImpl (this=<optimized out>, this@entry=0x712001da1098, thread_num=<optimized out>, yield_flag=yield_flag@entry=0x0) at ../src/Processors/Executors/PipelineExecutor.cpp:217
#49 0x000000004076f2c9 in DB::PipelineExecutor::executeSingleThread (this=0x712001da1098, thread_num=140057039475624) at ../src/Processors/Executors/PipelineExecutor.cpp:182
#50 DB::PipelineExecutor::executeImpl(unsigned long)::$_1::operator()() const (this=0x7f6192164700) at ../src/Processors/Executors/PipelineExecutor.cpp:310
#51 std::__1::__invoke_constexpr<DB::PipelineExecutor::executeImpl(unsigned long)::$_1&>(DB::PipelineExecutor::executeImpl(unsigned long)::$_1&) (__f=...) at ../contrib/libcxx/include/type_traits:3648
#52 std::__1::__apply_tuple_impl<DB::PipelineExecutor::executeImpl(unsigned long)::$_1&, std::__1::tuple<>&>(DB::PipelineExecutor::executeImpl(unsigned long)::$_1&, std::__1::tuple<>&, std::__1::__tuple_indices<>) (__f=..., __t=...) at ../contrib/libcxx/include/tuple:1595
#53 std::__1::apply<DB::PipelineExecutor::executeImpl(unsigned long)::$_1&, std::__1::tuple<>&>(DB::PipelineExecutor::executeImpl(unsigned long)::$_1&, std::__1::tuple<>&) (__f=..., __t=...) at ../contrib/libcxx/include/tuple:1604
#54 ThreadFromGlobalPool::ThreadFromGlobalPool<DB::PipelineExecutor::executeImpl(unsigned long)::$_1>(DB::PipelineExecutor::executeImpl(unsigned long)::$_1&&)::{lambda()#1}::operator()() (this=<optimized out>) at ../src/Common/ThreadPool.h:188
#55 std::__1::__invoke<ThreadFromGlobalPool::ThreadFromGlobalPool<DB::PipelineExecutor::executeImpl(unsigned long)::$_1>(DB::PipelineExecutor::executeImpl(unsigned long)::$_1&&)::{lambda()#1}&>(DB::PipelineExecutor::executeImpl(unsigned long)::$_1&&) (__f=...) at ../contrib/libcxx/include/type_traits:3640
#56 std::__1::__invoke_void_return_wrapper<void, true>::__call<ThreadFromGlobalPool::ThreadFromGlobalPool<DB::PipelineExecutor::executeImpl(unsigned long)::$_1>(DB::PipelineExecutor::executeImpl(unsigned long)::$_1&&)::{lambda()#1}&>(ThreadFromGlobalPool::ThreadFromGlobalPool<DB::PipelineExecutor::executeImpl(unsigned long)::$_1>(DB::PipelineExecutor::executeImpl(unsigned long)::$_1&&)::{lambda()#1}&) (__args=...) at ../contrib/libcxx/include/__functional/invoke.h:61
#57 std::__1::__function::__default_alloc_func<ThreadFromGlobalPool::ThreadFromGlobalPool<DB::PipelineExecutor::executeImpl(unsigned long)::$_1>(DB::PipelineExecutor::executeImpl(unsigned long)::$_1&&)::{lambda()#1}, void ()>::operator()() (this=<optimized out>) at ../contrib/libcxx/include/__functional/function.h:230
#58 std::__1::__function::__policy_invoker<void ()>::__call_impl<std::__1::__function::__default_alloc_func<ThreadFromGlobalPool::ThreadFromGlobalPool<DB::PipelineExecutor::executeImpl(unsigned long)::$_1>(DB::PipelineExecutor::executeImpl(unsigned long)::$_1&&)::{lambda()#1}, void ()> >(std::__1::__function::__policy_storage const*) (__buf=<optimized out>) at ../contrib/libcxx/include/__functional/function.h:711
#59 0x000000000b8e40f1 in std::__1::__function::__policy_func<void ()>::operator()() const (this=0x7f6192164868) at ../contrib/libcxx/include/__functional/function.h:843
#60 std::__1::function<void ()>::operator()() const (this=0x7f6192164868) at ../contrib/libcxx/include/__functional/function.h:1184
#61 ThreadPoolImpl<std::__1::thread>::worker (this=0x70f000006cc0, thread_it=...) at ../src/Common/ThreadPool.cpp:281
#62 0x000000000b8ef741 in ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::{lambda()#2}::operator()() const (this=0x7020008f3688) at ../src/Common/ThreadPool.cpp:143
#63 std::__1::__invoke<ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::{lambda()#2}>(ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::{lambda()#2}&&, (ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::{lambda()#2}&&)...) (__f=...) at ../contrib/libcxx/include/type_traits:3640
#64 std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::{lambda()#2}>(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::{lambda()#2}>&, std::__1::__tuple_indices<>) (__t=...) at ../contrib/libcxx/include/thread:282
#65 std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::{lambda()#2}> >(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::{lambda()#2}>) (__vp=0x7020008f3680) at ../contrib/libcxx/include/thread:293
#66 0x00007f66871dc609 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#67 0x00007f6687101163 in clone () from /lib/x86_64-linux-gnu/libc.so.6
```

And a lot of stacks looks like:
```
#0  0x000000000b5ca2a7 in __sanitizer::internal_sched_yield() ()
#1  0x000000000b5db9da in __sanitizer::ScopedErrorReportLock::Lock() ()
#2  0x000000000b5d5433 in __sanitizer::ScopedAllocatorErrorReport::ScopedAllocatorErrorReport(char const*, __sanitizer::StackTrace const*) ()
#3  0x000000000b5d56f1 in __sanitizer::ReportOutOfMemory(unsigned long, __sanitizer::StackTrace const*) ()
#4  0x000000000b5e4b02 in __msan::MsanAllocate(__sanitizer::StackTrace*, unsigned long, unsigned long, bool) ()
#5  0x000000000b5e4916 in __msan::msan_malloc(unsigned long, __sanitizer::StackTrace*) ()
#6  0x000000000b5ee52f in malloc ()
```
DB::ConfigProcessor(config_path).savePreprocessedConfig(loaded_config, "");
    
    {
        struct rlimit rlim;
        if (getrlimit(RLIMIT_CORE, &rlim))
            throw Poco::Exception("Cannot getrlimit");
        
        rlim.rlim_cur = config().getUInt64("core_dump.size_limit", 1024 * 1024 * 1024);
        if (rlim.rlim_cur && setrlimit(RLIMIT_CORE, &rlim))
        {
            
            std::cerr << "Cannot set max size of core file to " + std::to_string(rlim.rlim_cur) << std::endl;
        }
    }
    
    if (config().has("timezone"))
    {
        const std::string config_timezone = config().getString("timezone");
        if (0 != setenv("TZ", config_timezone.data(), 1))
            throw Poco::Exception("Cannot setenv TZ variable");
        tzset();
        DateLUT::setDefaultTimezone(config_timezone);
    }
    std::string log_path = config().getString("logger.log", "");
    if (!log_path.empty())
        log_path = fs::path(log_path).replace_filename("");
    /** Redirect stdout, stderr to separate files in the log directory (or in the specified file).
      * Some libraries write to stderr in case of errors in debug mode,
      *  and this output makes sense even if the program is run in daemon mode.
      * We have to do it before buildLoggers, for errors on logger initialization will be written to these files.