diff options
author | Håvard Pettersen <havardpe@yahooinc.com> | 2023-11-13 14:00:45 +0000 |
---|---|---|
committer | Håvard Pettersen <havardpe@yahooinc.com> | 2023-11-13 14:00:45 +0000 |
commit | 4bf0e80369bf4fff155becb083de6775899de163 (patch) | |
tree | f016cb7ac238faea2a1c85b382045f0d8b6c48f7 /searchcore | |
parent | 24c328285d8726f4cf1aefd323c1e5096a6f83e9 (diff) |
fix tsan error
reported in VESPA-27749
Diffstat (limited to 'searchcore')
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp | 4 | ||||
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/matchengine/matchengine.h | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp index efe03c7b57e..1b891baa5c9 100644 --- a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp +++ b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp @@ -75,7 +75,7 @@ MatchEngine::close() LOG(debug, "Closing search interface."); { std::lock_guard<std::mutex> guard(_lock); - _closed = true; + _closed.store(true, std::memory_order_relaxed); } LOG(debug, "Handshaking with task manager."); @@ -108,7 +108,7 @@ SearchReply::UP MatchEngine::search(SearchRequest::Source request, SearchClient &client) { // We continue to allow searches if the node is in Maintenance mode - if (_closed || (!_nodeUp && !_nodeMaintenance.load(std::memory_order_relaxed))) { + if (_closed.load(std::memory_order_relaxed) || (!_nodeUp && !_nodeMaintenance.load(std::memory_order_relaxed))) { auto ret = std::make_unique<SearchReply>(); ret->setDistributionKey(_distributionKey); diff --git a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.h b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.h index 9d4bfc5cce5..5365cb6a290 100644 --- a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.h +++ b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.h @@ -20,7 +20,7 @@ private: std::mutex _lock; const uint32_t _distributionKey; bool _async; - bool _closed; + std::atomic<bool> _closed; std::atomic<bool> _forward_issues; HandlerMap<ISearchHandler> _handlers; vespalib::ThreadStackExecutor _executor; |