[SERVER-39347] Race in catalog cache loader Created: 01/Feb/19  Updated: 29/Oct/23  Resolved: 06/Feb/19

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: 4.1.8

Type: Bug Priority: Major - P3
Reporter: Ian Boros Assignee: Ian Boros
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
Participants:
Linked BF Score: 17

 Description   

In CatalogCache::checkEpochOrThrow() we check if there pointer to routingInfo associated with a collection is non-null.

In _scheduleCollectionRefresh() (which may run at the same time as a call to checkEpochOrThrow()), we std::move() from collEntry->routingInfo. See here. (Keep in mind that std::move()ing from a shared pointer will "transfer" the reference count to the left hand side, and set the right hand side to nullptr).

The routingInfo is reset once the refresh has completed here. This means that in the period during which the refresh is happening (after we've scheduled the refresh, dropped the mutex, and are waiting for the background thread here), the collection's routingInfo will be nullptr, so it will appear to be unsharded.



 Comments   
Comment by Githook User [ 06/Feb/19 ]

Author:

{'name': 'Ian Boros', 'email': 'puppyofkosh@gmail.com', 'username': 'puppyofkosh'}

Message: SERVER-39347 fix race in CatalogCache
Branch: master
https://github.com/mongodb/mongo/commit/f1b64f7fa6b071cde41498961c147b533893ad33

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