The patch is supposed to fix the following problems (extra
debugs onboard):
```
NFO 2021-11-16 01:18:38,713 [shard 0] osd - ~OSD: OSD dtor called
INFO 2021-11-16 01:18:38,713 [shard 0] osd - Heartbeat::Peer: osd.6 removed
INFO 2021-11-16 01:18:38,714 [shard 0] osd - Heartbeat::Peer: osd.5 removed
INFO 2021-11-16 01:18:38,714 [shard 0] osd - Heartbeat::Peer: osd.2 removed
INFO 2021-11-16 01:18:38,714 [shard 0] osd - ~ShardServices: ShardServices dtor called
INFO 2021-11-16 01:18:38,714 [shard 0] osd - ~ObjectContextRegistry: ShardServices dtor called; unref_size=3, size=3
INFO 2021-11-16 01:18:38,714 [shard 0] osd - ~ObjectContextRegistry: unreferenced p=0x619000115380
INFO 2021-11-16 01:18:38,714 [shard 0] osd - ~ObjectContextRegistry: unreferenced p=0x619000114980
INFO 2021-11-16 01:18:38,714 [shard 0] osd - ~ObjectContextRegistry: unreferenced p=0x619000112680
INFO 2021-11-16 01:18:38,714 [shard 0] osd - ~ObjectContextRegistry: set p=0x619000114980
INFO 2021-11-16 01:18:38,714 [shard 0] osd - ~ObjectContextRegistry: set p=0x619000115380
INFO 2021-11-16 01:18:38,714 [shard 0] osd - ~ObjectContextRegistry: set p=0x619000112680
INFO 2021-11-16 01:18:38,738 [shard 0] osd - crimson shutdown complete
=================================================================
==33351==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 2808 byte(s) in 3 object(s) allocated from:
#0 0x7fe10c0327b0 in operator new(unsigned long) (/lib64/libasan.so.5+0xf17b0)
#1 0x55accbe8ffc4 in ceph::common::intrusive_lru<ceph::common::intrusive_lru_config<hobject_t, crimson::osd::ObjectContext, crimson::osd::obc_to_hoid<crimson::osd::ObjectContext> > >::get_or_create(hobject_t const&) (/usr/bin/ceph-osd+0x3b000fc4)
Objects leaked above:
0x619000112680 (936 bytes)
0x619000114980 (936 bytes)
0x619000115380 (936 bytes)
```
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
conf.add_observer(this);
}
+ObjectContextRegistry::~ObjectContextRegistry()
+{
+ // purge the cache to avoid leaks and complains from LSan
+ obc_lru.set_target_size(0UL);
+}
+
const char** ObjectContextRegistry::get_tracked_conf_keys() const
{
static const char* KEYS[] = {
public:
ObjectContextRegistry(crimson::common::ConfigProxy &conf);
+ ~ObjectContextRegistry();
std::pair<ObjectContextRef, bool> get_cached_obc(const hobject_t &hoid) {
return obc_lru.get_or_create(hoid);