[SERVER-31518] There is no way to safely register a shutdown task without potentially crashing if we happen to be in shutdown mode Created: 11/Oct/17 Updated: 27/Oct/23 Resolved: 16/Oct/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Sharding |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Dianna Hohensee (Inactive) | Assignee: | Dianna Hohensee (Inactive) |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Operating System: | ALL | ||||||||
| Sprint: | Sharding 2017-10-23 | ||||||||
| Participants: | |||||||||
| Description |
|
See BF-6795 linked below. In summary, we create a service and register a shutdown task during sharding state initialization, at which time we can be in shutdown mode and invariant the shutdown task registration. This can happen generically for any task we register for shutdown. Perhaps a mutex could protect the shutdownFlag, such that a service can be both created and its shutdown task registered, before allowing modification to the shutdownFlag, thus adding safety. |
| Comments |
| Comment by Dianna Hohensee (Inactive) [ 16/Oct/17 ] |
|
Closing this ticket because registering a shutdown task works correctly, rather PeriodicBalancerSettingsRefresher is misusing it. PeriodicBalancerSettingsRefresher should be instantiated during start up, it's shutdown task safely registered at that time when we're single-threaded, and then sharding initialization should only be starting the service. Created |
| Comment by Dianna Hohensee (Inactive) [ 11/Oct/17 ] |
|
Yeah, it is an interesting question what our task registration expectations should be, and what they currently are. We have services that only run when primary (auto-balancer), and services that only run once sharding initializes (the failure prompting creating this ticket). Those are the ones that I'm aware of, anyway. |
| Comment by Andy Schwerin [ 11/Oct/17 ] |
|
Sharding state initialization happens after the process is multithreaded, right? I think that might just be too late to register a shutdown handler. They are intended to be registered during process initialization. Please talk to acm about this. |