Hello Zoltan Martonka, Abhishek Chennaka,
I'd like you to do a code review. Please visit
http://gerrit.cloudera.org:8080/21960
to review the following change.
Change subject: KUDU-3620 fix heap-use-after-free and undefined behavior in
OpDriver
......................................................................
KUDU-3620 fix heap-use-after-free and undefined behavior in OpDriver
This patch fixes a long-standing heap-use-after-free issue in OpDriver.
The problem is addressed by supplying a valid reference to OpDriver
objects for callbacks to make sure objects aren't destroyed while
their methods are being invoked.
The reference-counting wrapper for OpDriver objects changed from
scoped_refptr to std::shared_ptr. It allows for passing weak pointers
(std::weak_ptr) instead of raw pointers to callbacks where reference
counting cycle was suspected (left the clarification of the latter as
TODOs), so a valid shared pointer can be constructed before invoking any
of the required OpDriver's methods.
I also updated the signature of OpTracker::GetPendingOps() to get rid of
output parameter.
Before this patch, running the following against Kudu bits built in
ASAN configuration would trigger ASAN and UBSAN warnings once in about
150 runs:
./ts_recovery-itest \
--gtest_filter='DifferentFaultPoints/Kudu969Test.Test/*' \
--gtest_repeat=10000
With this patch, more than 2K iterations of the same succeeded without
producing a single ASAN/UBSAN issue report.
Change-Id: Iadc58f1724bc03373a7e165fd3798b8868dc9d29
Reviewed-on: http://gerrit.cloudera.org:8080/21948
Tested-by: Alexey Serbin <[email protected]>
Reviewed-by: Zoltan Martonka <[email protected]>
Reviewed-by: Abhishek Chennaka <[email protected]>
(cherry picked from commit c51e1354322a4d2cad268de26f254dd52b0c9df1)
Conflicts:
src/kudu/tablet/ops/op_driver.cc
src/kudu/tablet/ops/op_tracker.cc
src/kudu/tablet/tablet_replica.cc
src/kudu/tablet/tablet_replica.h
---
M src/kudu/tablet/ops/op_driver.cc
M src/kudu/tablet/ops/op_driver.h
M src/kudu/tablet/ops/op_tracker-test.cc
M src/kudu/tablet/ops/op_tracker.cc
M src/kudu/tablet/ops/op_tracker.h
M src/kudu/tablet/tablet_replica-test.cc
M src/kudu/tablet/tablet_replica.cc
M src/kudu/tablet/tablet_replica.h
M src/kudu/tablet/txn_participant-test.cc
9 files changed, 137 insertions(+), 114 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/60/21960/1
--
To view, visit http://gerrit.cloudera.org:8080/21960
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: branch-1.17.x
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iadc58f1724bc03373a7e165fd3798b8868dc9d29
Gerrit-Change-Number: 21960
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Serbin <[email protected]>
Gerrit-Reviewer: Abhishek Chennaka <[email protected]>
Gerrit-Reviewer: Zoltan Martonka <[email protected]>