[SERVER-43241] Fix Executor failures in ARS dtor during shutdown Created: 09/Sep/19  Updated: 29/Oct/23  Resolved: 30/Oct/19

Status: Closed
Project: Core Server
Component/s: Networking
Affects Version/s: 4.0.12
Fix Version/s: 4.0.14

Type: Bug Priority: Major - P3
Reporter: Mira Carey Assignee: Benjamin Caimano (Inactive)
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-43379 "Invariant failure _sessions.empty()"... Closed
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Service Arch 2019-09-23, Service Arch 2019-10-07, Service Arch 2019-10-21, Service Arch 2019-11-04
Participants:
Case:

 Description   

There are a variety of bad races in global shutdown present in pre-4.2 versions of mongod and mongos. The principal problem is that we have a variety of background executors which are used for networking which are held on user threads by bare pointer. During global shutdown, we kill all user operations (which begins unwinding user stacks), while also shutting down and destroying those global objects. This can lead to use after frees, as well as scheduling errors, if those user threads unwind after global executor destruction.

These problems tend to be rare because we do process termination via _Exit, which doesn't usually join user threads, meaning we tend only to see these problems in the presence of many user threads, where the shutdown thread get's descheduled at particular points in execution.

Note that this problem also isn't present in 4.2 and later, as we've replaced the executor machinery so that executors are held by shared_ptr, and callbacks can see if they're being run on shutdown executors.



 Comments   
Comment by Githook User [ 30/Oct/19 ]

Author:

{'username': 'bcaimano', 'email': 'ben.caimano@mongodb.com', 'name': 'Ben Caimano'}

Message: SERVER-43241 Never shutdown grid executors

This commit is applied only to v4.0.
Branch: v4.0
https://github.com/mongodb/mongo/commit/2fde5d70e4b45caf243019afe2d27d4a77f07194

Generated at Thu Feb 08 05:02:38 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.