This is an automated email from the ASF dual-hosted git repository.

achennaka pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git


The following commit(s) were added to refs/heads/master by this push:
     new feaf1daf5 [tablet] fix race accessing OpState's start time
feaf1daf5 is described below

commit feaf1daf56895c921fd08917334ce31d81f8b3e4
Author: Alexey Serbin <ale...@apache.org>
AuthorDate: Tue May 14 12:34:07 2024 -0700

    [tablet] fix race accessing OpState's start time
    
    This patch addresses a race reported by TSAN with traces like below:
    
    WARNING: ThreadSanitizer: data race (pid=11024)
      Write of size 8 at 0x7b580011f260 by thread T174:
        #0 kudu::tablet::OpState::set_start_time(kudu::MonoTime) 
src/kudu/tablet/ops/op.h:274:58
        #1 kudu::tablet::WriteOp::Start() src/kudu/tablet/ops/write_op.cc:273:11
        #2 kudu::tablet::OpDriver::Prepare() 
src/kudu/tablet/ops/op_driver.cc:329:7
        #3 kudu::tablet::OpDriver::PrepareTask() 
src/kudu/tablet/ops/op_driver.cc:249:31
        ...
    
      Previous read of size 8 at 0x7b580011f260 by thread T5 (mutexes: write 
M835553159786377312):
        #0 kudu::tablet::OpState::start_time() const 
src/kudu/tablet/ops/op.h:272:40
        #1 kudu::tablet::WriteOp::ToString() const 
src/kudu/tablet/ops/write_op.cc:378:36
        #2 kudu::tablet::OpDriver::ToStringUnlocked() const 
src/kudu/tablet/ops/op_driver.cc:209:23
        #3 kudu::tablet::OpDriver::ToString() const 
src/kudu/tablet/ops/op_driver.cc:203:10
        #4 kudu::tablet::TabletReplica::GetInFlightOps(...) const 
src/kudu/tablet/tablet_replica.cc:728:41
        #5 kudu::tserver::TabletServerPathHandlers::HandleTransactionsPage(...) 
src/kudu/tserver/tserver_path_handlers.cc:286:14
        ...
    
    Change-Id: I52de0840aa20f64cf15c7a9da2d553257c7e85e7
    Reviewed-on: http://gerrit.cloudera.org:8080/21427
    Tested-by: Kudu Jenkins
    Reviewed-by: Abhishek Chennaka <achenn...@cloudera.com>
---
 src/kudu/tablet/ops/op.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/kudu/tablet/ops/op.h b/src/kudu/tablet/ops/op.h
index 5c184e823..bc167e9e7 100644
--- a/src/kudu/tablet/ops/op.h
+++ b/src/kudu/tablet/ops/op.h
@@ -315,7 +315,7 @@ class OpState {
 
   // Use to record the op's start time.
   // 'set_start_time()' needs to be called at the beginning of the op to 
initialize it.
-  MonoTime start_time_;
+  std::atomic<MonoTime> start_time_;
 };
 
 // A parent class for the callback that gets called when ops

Reply via email to