forked from robmoorman/SubstratumNode
-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
Graceful Shutdown is a big epic. We can get it started here with only a small chunk of its eventual capabilities, leaving most of the shutdown as ungraceful as it already is. This card is an child of the [https://github.com/MASQ-Project/Node/issues/406] spike. Check out the comments on that card for a complete picture of this process.
Tasks
- Currently,
UiShutdownRequestis passed from theUiGatewayto theNeighborhood, and theNeighborhoodhandles it and terminates the process. Modify this so that theUiGatewayrecognizes theUiShutdownRequestand handles the process termination. - Modify the
UiGatewayso that when it receives aUiShutdownRequest, it sets an alarm (perhaps queues up a message for itself to be sent in five seconds) and sends a shutdown command as an Actor message to theStreamHandlerPool(the Actor, not the one inProxyClient). Keep in mind that eventually theUiGatewaywill need to send this message to every Actor. - Modify the
StreamHandlerPoolso that when it receives a shutdown command, it does the following (this is the list of tasks mentioned in [https://github.com/Graceful Shutdown Spike Node#406] minus two elements that will be added as Graceful Shutdown is filled out):- Shut down all TCP streams. The easy way to do this will be to traverse
StreamHandlerPool::stream_writersand sendRemoveStreamMsgs to theStreamHandlerPool(or, more conveniently, just callStreamHandlerPool::handle_remove_stream_msg()) for each one. However, each time aRemoveStreamMsgis processed, theNeighborhoodwill be directed to remove a half-neighborship and broadcast Standard Gossip. This will mean we'll need a delay to make sure all the Gossip is sent out, and a separate Standard Gossip message for each removed stream will cause a brief Gossip storm on the network. The right way to do it is to invent a newWithdrawFromNetworkMsgthat can be sent directly to theNeighborhoodwithout routing through theDispatcherthat, upon receipt, will cause removal of all outgoing half-neighborships, and then trigger one round of Standard Gossip to all immediate neighbors showing those removals. - Listen for an okay-I'm-done Actor message from the
Neighborhoodto signal that the Standard Gossip is on its way. (This okay-I'm-done message will be very common in the complete Graceful Shutdown: it should be designed to be generic. It should contain enough information so that the receiver can tell which Actor is claiming to be done.) - Send an identical okay-I'm-done message to the UiGateway.
- Shut down all TCP streams. The easy way to do this will be to traverse
- Modify the UiGateway so that when it gets either the okay-I'm-done message from the
StreamHandlerPoolor the previously-set alarm goes off, it kills the process.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
🆕 New