During invalidateIf, the cache will lock a weak_ptr and later attempt to invalidate it. https://github.com/mongodb/mongo/blob/b079e4713d897b5541c2804386025817ec720800/src/mongo/util/invalidating_lru_cache.h#L124
We should make sure that the lock happened successfully, before attempting further processing.