diff options
author | jinichu <jinnybyun@gmail.com> | 2018-08-08 09:17:10 -0400 |
---|---|---|
committer | jinichu <jinnybyun@gmail.com> | 2018-08-08 09:17:10 -0400 |
commit | e3a69aae7d5a45a61ea7796efdeb77b4392597e4 (patch) | |
tree | 3b506e6e72ec83bc67d5a87dfde527bcd923b634 /src/mongo/db/session_catalog.cpp | |
parent | e02b9388ce31740cb2daf7ed86ead382ed66b3b5 (diff) | |
download | mongo-e3a69aae7d5a45a61ea7796efdeb77b4392597e4.tar.gz |
SERVER-36007 Fixed self-deadlock caused by checking out an already checked out session in SessionCatalog
Diffstat (limited to 'src/mongo/db/session_catalog.cpp')
-rw-r--r-- | src/mongo/db/session_catalog.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mongo/db/session_catalog.cpp b/src/mongo/db/session_catalog.cpp index 614e2ed8144..24fcea6b37e 100644 --- a/src/mongo/db/session_catalog.cpp +++ b/src/mongo/db/session_catalog.cpp @@ -258,10 +258,11 @@ OperationContextSession::OperationContextSession(OperationContext* opCtx, auto& checkedOutSession = operationSessionDecoration(opCtx); if (!checkedOutSession) { auto sessionTransactionTable = SessionCatalog::get(opCtx); + auto scopedCheckedOutSession = sessionTransactionTable->checkOutSession(opCtx); // We acquire a Client lock here to guard the construction of this session so that // references to this session are safe to use while the lock is held. stdx::lock_guard<Client> lk(*opCtx->getClient()); - checkedOutSession.emplace(sessionTransactionTable->checkOutSession(opCtx)); + checkedOutSession.emplace(std::move(scopedCheckedOutSession)); } else { // The only reason to be trying to check out a session when you already have a session // checked out is if you're in DBDirectClient. |