[SERVER-19162] unsafe access to grid.catalogManager at shutdown Created: 26/Jun/15  Updated: 25/Jan/17  Resolved: 25/Sep/15

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 3.1.4
Fix Version/s: 3.1.9

Type: Bug Priority: Major - P3
Reporter: Randolph Tan Assignee: Andy Schwerin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-20382 Null pointer dereference on shutdown Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Sharding 9 (09/18/15), Sharding A (10/09/15)
Participants:

 Description   

calls to grid.catalogManager() does not have any synchronization protection. This is fine in mongos as it is initialized at startup and is never modified. However, this is not true for mongod as the initialization happens when the server is processing requests. This is fine in most of mongod usages in d_migrate, d_split and d_merge since they ensure that it has been properly initialized (with the mutex) with the exception of the exit handler:

https://github.com/mongodb/mongo/blob/r3.1.4/src/mongo/db/instance.cpp#L1292



 Comments   
Comment by Githook User [ 25/Sep/15 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@mongodb.com'}

Message: SERVER-19162 Guard shut down of sharding state on mongod with same concurrency control as initialization.
Branch: master
https://github.com/mongodb/mongo/commit/4980f0d20ed494da2862c337cd2dc1fc7a5dd422

Generated at Thu Feb 08 03:50:01 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.