facebook / rocksdb

A library that provides an embeddable, persistent key-value store for fast storage.
http://rocksdb.org
GNU General Public License v2.0
27.85k stars 6.2k forks source link

Assertion triggered when stats is enabled due to small buffer #12740

Open ZLikuAxz opened 1 month ago

ZLikuAxz commented 1 month ago

https://github.com/facebook/rocksdb/blob/a211e065520b80a2a5a28a795aae1a71e1b139dc/monitoring/statistics.cc#L533

If we set StatsLevel to All using "StatsLevel": "All",, rocksdb triggers assertion with the stack below:

11 0000005a`eb57f3e0 00007ff7`57fce2d7     Awesome_wassert+0x2f
12 0000005a`eb57f410 00007ff7`57ff53c3     Awesome!rocksdb::StatisticsImpl::ToString+0x2d7
13 (Inline Function) --------`--------     Awesome!rocksdb::DBImpl::PrintStatistics+0x1d
14 0000005a`eb57f6e0 00007ff7`5820076a     Awesome!rocksdb::DBImpl::DumpStats+0x563
15 (Inline Function) --------`--------     Awesome!std::_Func_class<void>::operator()+0x13
16 0000005a`eb57f870 00007ff7`5810aaa9     Awesome!rocksdb::Timer::Run+0x2ba

Because the fixed sized buffer is not long enough to hold the formatted string. Maybe should change %f to %g?