Skip to content

Conversation

@RobbieMcKinstry
Copy link
Contributor

This commit changes the shutdown order of the subsystems.
Previously, when Ctrl-C was received, all subsystems would
simultaniously receive the shutdown signal. Now, all parent
subsystems receive the shutdown signal first, then propagate
the signal to their children. They also wait for their children
to shutdown before shutting down themselves.

This will allow us to control the order in which shutdown occurs.
For example, we can wait for channels to drain before closing them,
or differentiate between Ctrl-C shutdowns and error shutdowns.

This commit changes the shutdown order of the subsystems.
Previously, when Ctrl-C was received, all subsystems would
simultaniously receive the shutdown signal. Now, all parent
subsystems receive the shutdown signal first, then propagate
the signal to their children. They also wait for their children
to shutdown before shutting down themselves.

This will allow us to control the order in which shutdown occurs.
For example, we can wait for channels to drain before closing them,
or differentiate between Ctrl-C shutdowns and error shutdowns.
Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

This commit changes subsystem shutdown in the controller to be more
careful about order and parentage to ensure we're shutting down
our subsystems without writing to closed channels.
// any state locks that we've taken before we can roll back
// the ingress or yank the platform.
relay_subsys.initiate_shutdown();
relay_subsys.join().await?;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pseudo-code.

Suggested change
relay_subsys.join().await?;
if let Err(_) = relay_subsys.join().await? {
backend.shutdown_irregular(); // POST to backend to mark as errored.
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also need to change the on_error to CatchAndLocalShutdown.

@RobbieMcKinstry RobbieMcKinstry marked this pull request as draft June 12, 2025 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants