mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Fix overflow in exponential sleep in DirectoryMonitor
UBsan reports: SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/Storages/Distributed/DirectoryMonitor.cpp:435:53 in ../src/Storages/Distributed/DirectoryMonitor.cpp:435: runtime error: 1.15292e+19 is outside the range of representable values of type 'long' 0 0x1df0c286 in DB::StorageDistributedDirectoryMonitor::run() obj-x86_64-linux-gnu/../src/Storages/Distributed/DirectoryMonitor.cpp:435:53 It is pretty easy to reproduce by limiting max_server_memory_usage before staring the test.
This commit is contained in:
parent
e2d8ba893a
commit
a3653bd665
@ -432,7 +432,7 @@ void StorageDistributedDirectoryMonitor::run()
|
||||
do_sleep = true;
|
||||
++status.error_count;
|
||||
sleep_time = std::min(
|
||||
std::chrono::milliseconds{Int64(default_sleep_time.count() * std::exp2(status.error_count))},
|
||||
std::chrono::milliseconds{UInt64(default_sleep_time.count() * std::exp2(status.error_count))},
|
||||
max_sleep_time);
|
||||
tryLogCurrentException(getLoggerName().data());
|
||||
status.last_exception = std::current_exception();
|
||||
|
Loading…
Reference in New Issue
Block a user