[SERVER-38429] Signal all threads waiting for checking out session on session checkin Created: 05/Dec/18  Updated: 29/Oct/23  Resolved: 20/Dec/18

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: 4.1.7

Type: Bug Priority: Major - P3
Reporter: Siyuan Zhou Assignee: Siyuan Zhou
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Repl 2018-12-17, Repl 2019-01-14
Participants:
Linked BF Score: 45

 Description   

SessionCatalog::checkOutSession() waits until no one has checked it out AND no one has killed it.

    opCtx->waitForConditionOrInterrupt(sri->availableCondVar, ul, [&sri]() {
        return !sri->session.currentOperation() && !sri->session.killed();
    });

While, SessionCatalog::checkOutSessionForKill only waits until no one has checked it out.

    opCtx->waitForConditionOrInterrupt(
        sri->availableCondVar, ul, [&sri]() { return !sri->session.currentOperation(); });

When a session checks in, the thread only notifies the next one:

    sri->availableCondVar.notify_one();

If both a normal checkout and a checkOutForKill are waiting for the session checkin, however the normal checkout is the first in the queue, it wakes up, realizes the session is killed, and sleeps again. checkOutForKill won't have a chance to wake up. Changing the notify_one to notify_all will fix this problem.



 Comments   
Comment by Githook User [ 20/Dec/18 ]

Author:

{'username': 'benety', 'email': 'benety@mongodb.com', 'name': 'Benety Goh'}

Message: SERVER-38429 fix lint
Branch: master
https://github.com/mongodb/mongo/commit/424946d39691708bad0b0719ce4e67138b747c5e

Comment by Githook User [ 20/Dec/18 ]

Author:

{'username': 'visualzhou', 'email': 'siyuan.zhou@mongodb.com', 'name': 'Siyuan Zhou'}

Message: SERVER-38429 Signal all threads waiting for checking out session on session checkin
Branch: master
https://github.com/mongodb/mongo/commit/b1067e9c54c266c8a98af62e0cc02b5372ae5d40

Generated at Thu Feb 08 04:48:56 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.