{"push_id":982285386,"size":1,"distinct_size":1,"ref":"refs/heads/master","head":"e284a93c40740ad8bd3b5b95ee31e98c24aa4a6f","before":"444007746895122687fb9c8ea5274fb15974fe37","commits":[{"sha":"e284a93c40740ad8bd3b5b95ee31e98c24aa4a6f","author":{"email":"2c763d726a8c2f6afda9be7e0e56a2caa6bb5e6b@apache.org","name":"Todd Lipcon"},"message":"mem_tracker: fix a potential bad_weak_ptr\n\nThis fixes the following race:\n\nT1 is calling MemTracker::FindOrCreateTracker for a tracker that does\nnot yet exist:\n- T1 registers the new MemTracker as a child in the root tracker's child list.\n  This was a raw pointer, prior to this patch.\n- T1 constructs a shared_ptr, incrementing the ref count to 1.\n- T1 returns the shared_ptr to the user.\n- The user drops the reference to the shared_ptr back to 0, such that it is\n  being deleted. The destructor is called, and the thread is switched out\n  before the raw pointer can be removed from the root tracker's child list.\n\nT2 now runs, where a caller is trying to FindOrCreateTracker() with the\nsame identifier:\n- T2 looks in the child tracker and sees a matching MemTracker instance.\n- T2 tries to call tracker->shared_from_this(), but the refcount is 0,\n  so it throws bad_weak_ptr.\n\nThe fix is to use proper std::weak_ptrs for the child list instead of\nraw pointers. A new unit test reproduces the bug consistently.\n\nChange-Id: I1e1c225d6670025a9b4729013747652a30dfe608\nReviewed-on: http://gerrit.cloudera.org:8080/2212\nReviewed-by: Adar Dembo <adar@cloudera.com>\nTested-by: Kudu Jenkins","distinct":true,"url":"https://api.github.com/repos/cloudera/kudu/commits/e284a93c40740ad8bd3b5b95ee31e98c24aa4a6f"}]}