[SERVER-33959] CursorManager attempts to dispose of aggregation cursors while holding partitioned lock, which leads to deadlock Created: 17/Mar/18 Updated: 29/Oct/23 Resolved: 15/May/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework, Querying |
| Affects Version/s: | 3.6.0, 3.7.1 |
| Fix Version/s: | 3.6.6, 4.0.0-rc0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Max Hirschhorn | Assignee: | Charlie Swanson |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||
| Backport Requested: |
v3.6
|
||||||||||||||||||||
| Sprint: | Query 2018-05-07, Query 2018-05-21 | ||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Linked BF Score: | 19 | ||||||||||||||||||||
| Description |
|
Attempting to acquire a LockManager lock while holding a mutex is prone to deadlock. The CursorManager::killCursor() function locks the partition of CursorManager::_cursorMap corresponding to the specified cursor id. While holding the mutex, it calls ClientCursor::dispose(), which for an aggregation cursor attempts to acquire the collection lock in DocumentSourceCursor::cleanupExecutor() as part of DocumentSourceCursor::doDispose(). The "listCollections" and "listIndexes" commands hold the collection lock when attempting to call CursorManager::registerCursor(), forming the other edge of the deadlock cycle.
|
| Comments |
| Comment by Githook User [ 14/Jun/18 ] |
|
Author: {'username': 'cswanson310', 'name': 'Charlie Swanson', 'email': 'charlie.swanson@mongodb.com'}Message: (cherry picked from commit fa9278c892a6833694983191a5726b20f6a187a0) |
| Comment by Githook User [ 15/May/18 ] |
|
Author: {'email': 'charlie.swanson@mongodb.com', 'username': 'cswanson310', 'name': 'Charlie Swanson'}Message: |