From 367c72675cd821a69b70f03c7d8da1f553323889 Mon Sep 17 00:00:00 2001 From: groot Date: Thu, 2 Jul 2020 19:03:24 +0800 Subject: [PATCH] #2692 Milvus hangs during multi-thread concurrent search (#2715) * #2642 Create index failed caused by server crashed. Signed-off-by: yhmo * changelog Signed-off-by: yhmo * changelog Signed-off-by: yhmo * typo Signed-off-by: yhmo * #2692 Milvus hangs during multi-thread concurrent search Signed-off-by: yhmo --- CHANGELOG.md | 1 + core/src/server/delivery/request/BaseRequest.cpp | 1 + core/src/server/delivery/request/BaseRequest.h | 9 +++++---- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea46080777..3105530a4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ Please mark all change in change log and use the issue from GitHub - \#2637 Suit the range of HNSW parameters - \#2642 Create index failed and server crashed - \#2649 Search parameter of annoy has conflict with document +- \#2692 Milvus hangs during multi-thread concurrent search ## Feature diff --git a/core/src/server/delivery/request/BaseRequest.cpp b/core/src/server/delivery/request/BaseRequest.cpp index 65ebc05502..bac0015763 100644 --- a/core/src/server/delivery/request/BaseRequest.cpp +++ b/core/src/server/delivery/request/BaseRequest.cpp @@ -127,6 +127,7 @@ BaseRequest::OnPostExecute() { void BaseRequest::Done() { + std::unique_lock lock(finish_mtx_); done_ = true; finish_cond_.notify_all(); } diff --git a/core/src/server/delivery/request/BaseRequest.h b/core/src/server/delivery/request/BaseRequest.h index 7def31950e..5ed4002800 100644 --- a/core/src/server/delivery/request/BaseRequest.h +++ b/core/src/server/delivery/request/BaseRequest.h @@ -211,15 +211,16 @@ class BaseRequest { protected: const std::shared_ptr context_; - mutable std::mutex finish_mtx_; - std::condition_variable finish_cond_; - RequestType type_; std::string request_group_; bool async_; - bool done_; Status status_; + private: + mutable std::mutex finish_mtx_; + std::condition_variable finish_cond_; + bool done_; + public: const std::shared_ptr& Context() const {