This is an automated email from the ASF dual-hosted git repository.
apitrou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new 19c66d822d ARROW-16461: [C++] Fix sporadic Thread Sanitizer failure
19c66d822d is described below
commit 19c66d822d9f6347c9fd5b2222e434739e48ec3b
Author: Antoine Pitrou <[email protected]>
AuthorDate: Thu May 5 15:43:17 2022 +0200
ARROW-16461: [C++] Fix sporadic Thread Sanitizer failure
In debug mode the `ThreadedTaskGroup::finished_` member would be read
unlocked, so make it atomic.
Note that the failure should be harmless, but still deserves fixing to
improve CI reliability.
Closes #13067 from pitrou/ARROW-16461-atomic-finished
Authored-by: Antoine Pitrou <[email protected]>
Signed-off-by: Antoine Pitrou <[email protected]>
---
cpp/src/arrow/util/task_group.cc | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/cpp/src/arrow/util/task_group.cc b/cpp/src/arrow/util/task_group.cc
index 7e8ab64b70..0679b6ef1f 100644
--- a/cpp/src/arrow/util/task_group.cc
+++ b/cpp/src/arrow/util/task_group.cc
@@ -79,7 +79,8 @@ class ThreadedTaskGroup : public TaskGroup {
: executor_(executor),
stop_token_(std::move(stop_token)),
nremaining_(0),
- ok_(true) {}
+ ok_(true),
+ finished_(false) {}
~ThreadedTaskGroup() override {
// Make sure all pending tasks are finished, so that dangling references
@@ -200,12 +201,12 @@ class ThreadedTaskGroup : public TaskGroup {
StopToken stop_token_;
std::atomic<int32_t> nremaining_;
std::atomic<bool> ok_;
+ std::atomic<bool> finished_;
// These members use locking
std::mutex mutex_;
std::condition_variable cv_;
Status status_;
- bool finished_ = false;
util::optional<Future<>> completion_future_;
};