-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kill all non-Terminated backends on drone start (#739)
Fixes the following bug: * drone process restarts * drone executor's `apply_action` receives a `BackendAction::Terminate` for a backend that's been running since before the restart * the `self.backends` map does not contain the backend's manager anymore because the process was restarted * the drone assumes the backend has been terminated and the backend continues running Tested locally: running `docker ps` shows that all previously created backends are terminated upon drone agent restart. Creating a unit test for this might involve a side quest because terminate currently hangs when the backend can't be found. This is a pre-existing issue outside of the scope of this bug, and I think the code here is sufficiently straightforward to merge without a dedicated test. # Demo In separate terminals: ```shell $ ./dev/postgres.sh && ./dev/controller.sh $ ./dev/drone.sh $ ./dev/proxy.sh ``` Spawn a bunch: ```shell $ ./dev/cli.sh connect --cluster 'localhost:9090' --image 'ghcr.io/jamsocket/demo-image-drop-four' $ ./dev/cli.sh connect --cluster 'localhost:9090' --image 'ghcr.io/jamsocket/demo-image-drop-four' ``` Check what's running in docker: ```shell $ docker ps ``` Stop the drone process, then restart it, observe that backends get killed: ``` $ ./dev/drone.sh ... INFO plane::drone::executor: Terminating preexisting backends backends=[(BackendName("21p3dk3zvlm4jl"), Ready { address: Some(BackendAddr(127.0.0.1:53635)) })... ``` Verify all containers have been killed in docker: ```shell $ docker ps ``` This is idempotent: stopping and restarting the drone multiple times works without issue.
- Loading branch information
1 parent
a07831a
commit ec3e8c7
Showing
3 changed files
with
117 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters