[SERVER-41702] Copy Collection NamespaceString before yielding locks in AutoGetCollectionForRead Created: 13/Jun/19  Updated: 29/Oct/23  Resolved: 14/Jun/19

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 4.0.11, 4.2.0-rc2, 4.3.1

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

Issue Links:
Backports
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.2, v4.0
Sprint: Execution Team 2019-06-17
Participants:
Linked BF Score: 0

 Description   

AutoGetCollectionForRead yields its locks here, then tries to print a const NamespaceString& nss here.

If the collection is dropped after the locks are yielded and before the line is printed, then it will result in an invalid access.

We should copy the NamespaceString before yielding locks to print later on.



 Comments   
Comment by Githook User [ 14/Jun/19 ]

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: SERVER-41702 Copy Collection NamespaceString before yielding locks in AutoGetCollectionForRead

(cherry picked from commit 0b48f950281196e2aa7744f3ac96671cbe69a614)
Branch: v4.0
https://github.com/mongodb/mongo/commit/65b00cc344da0c9050f887346af0fca3f485ee15

Comment by Githook User [ 14/Jun/19 ]

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: SERVER-41702 Copy Collection NamespaceString before yielding locks in AutoGetCollectionForRead

(cherry picked from commit 0b48f950281196e2aa7744f3ac96671cbe69a614)
Branch: v4.2
https://github.com/mongodb/mongo/commit/583be5daa39fa684e7672f61a2eb3a7ff42ebc49

Comment by Githook User [ 14/Jun/19 ]

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: SERVER-41702 Copy Collection NamespaceString before yielding locks in AutoGetCollectionForRead
Branch: master
https://github.com/mongodb/mongo/commit/0b48f950281196e2aa7744f3ac96671cbe69a614

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