Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MB-43028: [2/2] Make overhead tracking safe at VBucket destruction
Merging http://review.couchbase.org/c/kv_engine/+/136495 into master uncovered santizer issues (mad-hatter CV runs an older Clang and did not identify these issues). This patch resolves one of these issues, _before_ the above patch is merged to master. UndefinedBehaviorSanitizer: undefined-behavior ../kv_engine/engines/ep/src/ephemeral_bucket.cc:303:27 runtime error: member access within address 0x6160007fd780 which does not point to an object of type 'KVBucket' #0 0x7fa90ca0c9bd in EphemeralBucket::makeVBucket(...)::$_3::operator()(long) const /home/couchbase/jenkins/workspace/kv_engine.ASan-UBSan_master/build/../kv_engine/engines/ep/src/ephemeral_bucket.cc:303:27 #1 0x7fa90c620aac in std::function<void (long)>::operator()(long) const /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/std_function.h:706:14 #2 0x7fa90c61a036 in Checkpoint::~Checkpoint() /home/couchbase/jenkins/workspace/kv_engine.ASan-UBSan_master/build/../kv_engine/engines/ep/src/checkpoint.cc:224:5 The callback captures a pointer to the EphemeralBucket which created the VBucket, in order to use the EPStats instance. However, the EphemeralBucket may be destroyed before the VBucket, making this unsafe. Capture stats by reference directly to avoid this. Change-Id: Ide06432d4229a13bc79e21ab6484eca036ea3f75 Reviewed-on: http://review.couchbase.org/c/kv_engine/+/141493 Reviewed-by: Dave Rigby <[email protected]> Well-Formed: Build Bot <[email protected]> Tested-by: Build Bot <[email protected]>
- Loading branch information