Skip to content

Commit 76b3f01

Browse files
committed
common: CephContext::_refresh_perf_values() checks for null _mempool_perf
test_perf_counters_cache.cc initializes the CephContext with flag CINIT_FLAG_NO_CCT_PERF_COUNTERS which leaves both _cct_perf and _mempool_perf as nullptrs the CephContextServiceThread calls _refresh_perf_values() regularly, which guards _cct_perf->set() calls with a nullptr check, but the _mempool_perf->set() calls were unguarded this led to occasional unittest_perf_counters_cache segfaults in make check Fixes: https://tracker.ceph.com/issues/64895 Signed-off-by: Casey Bodley <[email protected]>
1 parent dfb2134 commit 76b3f01

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/common/ceph_context.cc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -999,11 +999,13 @@ void CephContext::_refresh_perf_values()
999999
_cct_perf->set(l_cct_total_workers, _heartbeat_map->get_total_workers());
10001000
_cct_perf->set(l_cct_unhealthy_workers, _heartbeat_map->get_unhealthy_workers());
10011001
}
1002-
unsigned l = l_mempool_first + 1;
1003-
for (unsigned i = 0; i < mempool::num_pools; ++i) {
1004-
mempool::pool_t& p = mempool::get_pool(mempool::pool_index_t(i));
1005-
_mempool_perf->set(l++, p.allocated_bytes());
1006-
_mempool_perf->set(l++, p.allocated_items());
1002+
if (_mempool_perf) {
1003+
unsigned l = l_mempool_first + 1;
1004+
for (unsigned i = 0; i < mempool::num_pools; ++i) {
1005+
mempool::pool_t& p = mempool::get_pool(mempool::pool_index_t(i));
1006+
_mempool_perf->set(l++, p.allocated_bytes());
1007+
_mempool_perf->set(l++, p.allocated_items());
1008+
}
10071009
}
10081010
}
10091011

0 commit comments

Comments
 (0)