diff options
| author | George Wangensteen <george.wangensteen@mongodb.com> | 2023-03-29 20:50:20 +0000 |
|---|---|---|
| committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-03-29 22:18:08 +0000 |
| commit | f0faf5547f917c2b69959a9c4771b67719d8dbee (patch) | |
| tree | 0c3bf2fb827387631358328d574be7dbf131262c /src/mongo/executor | |
| parent | 8b54de590651761acc08ac3d5e416307df873e45 (diff) | |
| download | mongo-f0faf5547f917c2b69959a9c4771b67719d8dbee.tar.gz | |
SERVER-75443 PinnedConnectionTaskExecutor::join waits for in-progress requests to finish even if they are already out of the request queue
Diffstat (limited to 'src/mongo/executor')
| -rw-r--r-- | src/mongo/executor/pinned_connection_task_executor.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/mongo/executor/pinned_connection_task_executor.cpp b/src/mongo/executor/pinned_connection_task_executor.cpp index b8270346bbf..727726e59c3 100644 --- a/src/mongo/executor/pinned_connection_task_executor.cpp +++ b/src/mongo/executor/pinned_connection_task_executor.cpp @@ -337,15 +337,12 @@ void PinnedConnectionTaskExecutor::join() { } invariant(_state == State::joinRequired || _state == State::joining); _state = State::joining; - if (_requestQueue.empty()) { - _state = State::shutdownComplete; - return; - } - // If the _requestQueue isn't empty, there must still be some thread - // doing networking, which will observe the cancellations we did above. - invariant(_isDoingNetworking); + _requestQueueEmptyCV.wait(lk, [this]() { return _requestQueue.empty() && !_isDoingNetworking; }); + + _executor->join(); + _state = State::shutdownComplete; return; } |
