[ 
https://issues.apache.org/jira/browse/KUDU-3119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17155078#comment-17155078
 ] 

Alexey Serbin commented on KUDU-3119:
-------------------------------------

One more instance of TSAN race report, log is attached. 
[^kudu-tool-test.20200709.txt.xz] 

I guess there is real race if trying to add a block at the same index from two 
different threads.  Yes, there is a lock per index, but consider what happens 
when two threads trying to access using {{operator[]}} if an element at the 
index which was not present:

{noformat}
bool LogBlockManager::AddLogBlock(LogBlockRefPtr lb) {
  // InsertIfNotPresent doesn't use move semantics, so instead we just
  // insert an empty scoped_refptr and assign into it down below rather
  // than using the utility function.
  int index = lb->block_id().id() & kBlockMapMask;
  std::lock_guard<simple_spinlock> l(*managed_block_shards_[index].lock);
  auto& blocks_by_block_id = *managed_block_shards_[index].blocks_by_block_id;
  LogBlockRefPtr* entry_ptr = &blocks_by_block_id[lb->block_id()];
  if (*entry_ptr) {
    // Already have an entry for this block ID.
    return false;
  }
...
{noformat}

> ToolTest.TestFsAddRemoveDataDirEndToEnd reports race under TSAN
> ---------------------------------------------------------------
>
>                 Key: KUDU-3119
>                 URL: https://issues.apache.org/jira/browse/KUDU-3119
>             Project: Kudu
>          Issue Type: Bug
>          Components: CLI, test
>            Reporter: Alexey Serbin
>            Priority: Minor
>         Attachments: kudu-tool-test.20200709.txt.xz, kudu-tool-test.log.xz
>
>
> Sometimes the {{TestFsAddRemoveDataDirEndToEnd}} scenario of the {{ToolTest}} 
> reports races for TSAN builds:
> {noformat}
> /data0/somelongdirectorytoavoidrpathissues/src/kudu/src/kudu/tools/kudu-tool-test.cc:266:
>  Failure
> Failed
> Bad status: Runtime error: /tmp/dist-test-taskIZqSmU/build/tsan/bin/kudu: 
> process exited with non-ze
> ro status 66
> Google Test trace:
> /data0/somelongdirectorytoavoidrpathissues/src/kudu/src/kudu/tools/kudu-tool-test.cc:265:
>  W0506 17:5
> 6:02.744191  4432 flags.cc:404] Enabled unsafe flag: --never_fsync=true
> I0506 17:56:02.780252  4432 fs_manager.cc:263] Metadata directory not provided
> I0506 17:56:02.780442  4432 fs_manager.cc:269] Using write-ahead log 
> directory (fs_wal_dir) as metad
> ata directory
> I0506 17:56:02.789638  4432 fs_manager.cc:399] Time spent opening directory 
> manager: real 0.007s
>         user 0.005s     sys 0.002s
> I0506 17:56:02.789986  4432 env_posix.cc:1676] Not raising this process' open 
> files per process limi
> t of 1048576; it is already as high as it can go
> I0506 17:56:02.790426  4432 file_cache.cc:465] Constructed file cache lbm 
> with capacity 419430
> ==================
> WARNING: ThreadSanitizer: data race (pid=4432)
> ...
> {noformat}
> The log is attached.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to