[SERVER-37496] The balancer shouldn't register a shutdown task after the process is multithreaded Created: 05/Oct/18  Updated: 29/Oct/23  Resolved: 23/Oct/18

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 3.4.17, 3.6.8, 4.0.3, 4.1.3
Fix Version/s: 3.4.19, 3.6.9, 4.0.4, 4.1.5

Type: Bug Priority: Major - P3
Reporter: Jack Mulrow Assignee: Jack Mulrow
Resolution: Fixed Votes: 0
Labels: sharding-wfbf-day
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.0, v3.6, v3.4
Sprint: Sharding 2018-11-05
Participants:
Linked BF Score: 0

 Description   

The balancer registers a shutdown task when it is created, but this happens after the mongod process is multithreaded, so it's possible for the server to be shutting down when the task is registered, which triggers this invariant.

Instead, we should probably check if the balancer exists in shutdownTask() defined in db.cpp and shut it down if it does, similar to what's done for other components. 



 Comments   
Comment by Githook User [ 20/Nov/18 ]

Author:

{'name': 'Jack Mulrow', 'email': 'jack.mulrow@mongodb.com', 'username': 'jsmulrow'}

Message: SERVER-37496 Register balancer shutdown task when MongoD is single-threaded

(cherry picked from commit 871f1234c72f3f390f81dc31fd8a95d8bc69cf91)
Branch: v3.4
https://github.com/mongodb/mongo/commit/68958ba2b0b572f937c24f365bf9d8894735a8c9

Comment by Githook User [ 29/Oct/18 ]

Author:

{'name': 'Jack Mulrow', 'email': 'jack.mulrow@mongodb.com', 'username': 'jsmulrow'}

Message: SERVER-37496 Register balancer shutdown task when MongoD is single-threaded

(cherry picked from commit 871f1234c72f3f390f81dc31fd8a95d8bc69cf91)
Branch: v3.6
https://github.com/mongodb/mongo/commit/98c2b9e9c05e18c3417dbfd882d7f32b81ec558e

Comment by Githook User [ 29/Oct/18 ]

Author:

{'name': 'Jack Mulrow', 'email': 'jack.mulrow@mongodb.com', 'username': 'jsmulrow'}

Message: SERVER-37496 Register balancer shutdown task when MongoD is single-threaded

(cherry picked from commit 871f1234c72f3f390f81dc31fd8a95d8bc69cf91)
Branch: v4.0
https://github.com/mongodb/mongo/commit/51ba5067d70313de211d22c1d7378024987c7908

Comment by Githook User [ 23/Oct/18 ]

Author:

{'name': 'Jack Mulrow', 'email': 'jack.mulrow@mongodb.com', 'username': 'jsmulrow'}

Message: SERVER-37496 Register balancer shutdown task when MongoD is single-threaded
Branch: master
https://github.com/mongodb/mongo/commit/871f1234c72f3f390f81dc31fd8a95d8bc69cf91

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