[SERVER-40171] Potential deadlock while migrating sessions Created: 15/Mar/19  Updated: 29/Oct/23  Resolved: 16/May/19

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 4.1.12

Type: Bug Priority: Major - P3
Reporter: Misha Tyulenev Assignee: Janna Golden
Resolution: Fixed Votes: 0
Labels: sharding-wfbf-day
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Sharding 2019-04-08, Sharding 2019-05-06, Sharding 2019-05-20
Participants:
Linked BF Score: 12

 Description   

SessionCatalogMigrationSource::_fetchNextNewWriteOplog() uses a DBDirectClient to do a query on the oplog. This is called after obtaining a lock as part of the AutoGetActiveCloner.
Attempting to read the oplog through the query system will end up calling waitForAllEarlierOplogWritesToBeVisible(). This will result in deadlocks sometimes, as there could be oplog writes that cannot become visible because they committed prior to some blocked uncommitted transaction that is blocked by the problematic code (thus completing the circle of deadlocks.)

The possible change _fetchNextNewWriteOplog() to not use a DBDirectClient.



 Comments   
Comment by Githook User [ 16/May/19 ]

Author:

{'email': 'golden.janna@gmail.com', 'name': 'jannaerin', 'username': 'jannaerin'}

Message: SERVER-40171 Release collection lock when fetching next oplog in _getNextSessionMods
Branch: master
https://github.com/mongodb/mongo/commit/bd0324546f6ca94d211130264c3774146cc1399b

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