[SERVER-37393] Fix destructor race in `ReplicaSetMonitorManager` Created: 28/Sep/18  Updated: 29/Oct/23  Resolved: 01/Oct/18

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 3.4.18, 3.6.9, 4.0.4, 4.1.4

Type: Bug Priority: Major - P3
Reporter: ADAM Martin (Inactive) Assignee: ADAM Martin (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Problem/Incident
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.0, v3.6, v3.4, v3.2
Sprint: Service Arch 2018-10-08
Participants:
Linked BF Score: 12

 Description   

The `_taskExecutor` pointer is destroyed before the `_monitors` members which refer to it, causing them to trip over uses of destroyed memory in some cases.

Simply reversing the order of these members should be sufficient to effect a fix.



 Comments   
Comment by Githook User [ 05/Oct/18 ]

Author:

{'name': 'ADAM David Alan Martin', 'email': 'adam.martin@10gen.com', 'username': 'adamlsd'}

Message: SERVER-37393 Fix dtor race in `ReplicaSetMonitorManager`

The members that have been reversed have an ownership-awareness
dependency which needs to be honored in order to prevent
certain races in shutdown of the `ReplicaSetMonitorManager`.

(cherry picked from commit f53b6852add200b7431a77a41e0d10c003706925)
Branch: v4.0
https://github.com/mongodb/mongo/commit/ed2ebd72f8dc3928cf91a7d1102045f2441e0e90

Comment by Githook User [ 05/Oct/18 ]

Author:

{'name': 'ADAM David Alan Martin', 'email': 'adam.martin@10gen.com', 'username': 'adamlsd'}

Message: SERVER-37393 Fix dtor race in `ReplicaSetMonitorManager`

The members that have been reversed have an ownership-awareness
dependency which needs to be honored in order to prevent
certain races in shutdown of the `ReplicaSetMonitorManager`.

(cherry picked from commit f53b6852add200b7431a77a41e0d10c003706925)
Branch: v3.4
https://github.com/mongodb/mongo/commit/7c26f67b8fd09740b5b55b4f031e3f95fab25fd0

Comment by Githook User [ 05/Oct/18 ]

Author:

{'name': 'ADAM David Alan Martin', 'email': 'adam.martin@10gen.com', 'username': 'adamlsd'}

Message: SERVER-37393 Fix dtor race in `ReplicaSetMonitorManager`

The members that have been reversed have an ownership-awareness
dependency which needs to be honored in order to prevent
certain races in shutdown of the `ReplicaSetMonitorManager`.

(cherry picked from commit f53b6852add200b7431a77a41e0d10c003706925)
Branch: v3.6
https://github.com/mongodb/mongo/commit/1d901ec399e1c8db787beaa67e2a94ce32b1be11

Comment by Githook User [ 01/Oct/18 ]

Author:

{'name': 'ADAM David Alan Martin', 'email': 'adam.martin@10gen.com', 'username': 'adamlsd'}

Message: SERVER-37393 Fix dtor race in `ReplicaSetMonitorManager`

The members that have been reversed have an ownership-awareness
dependency which needs to be honored in order to prevent
certain races in shutdown of the `ReplicaSetMonitorManager`.
Branch: master
https://github.com/mongodb/mongo/commit/f53b6852add200b7431a77a41e0d10c003706925

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