From 6223927f1c52db04054e538a09c55d643faedf82 Mon Sep 17 00:00:00 2001 From: Eric Curtin Date: Fri, 27 Nov 2026 21:36:46 +0000 Subject: [PATCH 1/2] fix(gateway): retry Docker while its backend is unavailable Signed-off-by: Eric Curtin --- crates/openshell-gateway/src/docker.rs | 2 -- crates/openshell-gateway/src/local_driver.rs | 22 +++++++-------- crates/openshell-gateway/src/podman.rs | 12 +-------- docs/how-it-works/gateways/configuration.mdx | 2 +- mise.lock | 28 +------------------- 5 files changed, 12 insertions(+), 54 deletions(-) diff --git a/crates/openshell-gateway/src/docker.rs b/crates/openshell-gateway/src/docker.rs index dfb68e20a5..e0b8105d72 100644 --- a/crates/openshell-gateway/src/docker.rs +++ b/crates/openshell-gateway/src/docker.rs @@ -15,8 +15,6 @@ use crate::local_driver::LocalDriver; pub const DOCKER: LocalDriver = LocalDriver { name: "docker", drop_legacy_keys: |_| {}, - // The in-process driver did not retry an unreachable daemon. - retry_unavailable: None, }; /// Detect Docker by starting its driver with the operator's table, so a diff --git a/crates/openshell-gateway/src/local_driver.rs b/crates/openshell-gateway/src/local_driver.rs index 3efee6cb35..caa22c8a8f 100644 --- a/crates/openshell-gateway/src/local_driver.rs +++ b/crates/openshell-gateway/src/local_driver.rs @@ -29,9 +29,6 @@ pub struct LocalDriver { /// Removes keys earlier releases accepted that the driver's strict table no /// longer does. The gateway warns about each, so the driver can reject them. pub drop_legacy_keys: fn(&mut toml::map::Map), - /// Start a named driver again this often while its backend is unreachable. - /// Drivers that never retried leave it unset. - pub retry_unavailable: Option, } /// The gateway's view of a driver's table: where its binary is, and the table @@ -163,13 +160,9 @@ impl LocalDriver { socket_dir, log_level: gateway_log_level, }; - let outcome = match self.retry_unavailable { - Some(retry) => { - launcher::launch_tolerating_unavailable(request, configure, on_exit, retry) - .await? - } - None => launcher::launch(request, configure, on_exit).await?, - }; + let outcome = + launcher::launch_tolerating_unavailable(request, configure, on_exit, BACKEND_RETRY) + .await?; match outcome { LaunchOutcome::Launched(launched) => launched, LaunchOutcome::InvalidConfig(reason) => { @@ -203,6 +196,9 @@ impl LocalDriver { } } -/// How long to wait between starts while a named driver's backend is down. -#[cfg(feature = "compute-driver-podman")] -pub const BACKEND_RETRY_DELAY: std::time::Duration = std::time::Duration::from_secs(2); +/// How often a named driver is started while its backend is unreachable, such +/// as a socket restarting during a package upgrade. +const BACKEND_RETRY: UnavailableRetry = UnavailableRetry { + attempts: 6, + delay: std::time::Duration::from_secs(2), +}; diff --git a/crates/openshell-gateway/src/podman.rs b/crates/openshell-gateway/src/podman.rs index 4623ec4fa7..027d2640e6 100644 --- a/crates/openshell-gateway/src/podman.rs +++ b/crates/openshell-gateway/src/podman.rs @@ -10,21 +10,11 @@ use openshell_server::{DriverDetection, DriverDetectionContext}; -use crate::launcher::UnavailableRetry; -use crate::local_driver::{BACKEND_RETRY_DELAY, LocalDriver}; - -/// How many times a named Podman is started while its socket is unreachable. -/// This keeps the bounded tolerance the in-process driver had, such as -/// `podman.socket` restarting during a package upgrade. -const START_ATTEMPTS: u32 = 6; +use crate::local_driver::LocalDriver; pub const PODMAN: LocalDriver = LocalDriver { name: "podman", drop_legacy_keys: drop_legacy_gateway_port, - retry_unavailable: Some(UnavailableRetry { - attempts: START_ATTEMPTS, - delay: BACKEND_RETRY_DELAY, - }), }; /// `main` accepted `gateway_port` and overwrote it with the gateway's diff --git a/docs/how-it-works/gateways/configuration.mdx b/docs/how-it-works/gateways/configuration.mdx index db461f8d66..4cc36f88f3 100644 --- a/docs/how-it-works/gateways/configuration.mdx +++ b/docs/how-it-works/gateways/configuration.mdx @@ -1569,7 +1569,7 @@ The gateway owns the admission policy (`allow_driver_config` and `resource_admis Set `driver_dir` in `[openshell.gateway]`. A `driver_dir` in a driver table is deprecated: the gateway removes it with a warning and uses it only when `[openshell.gateway]` sets none. The gateway looks for the driver binary in `driver_dir`, then in `~/.local/libexec/openshell`, `/usr/libexec/openshell`, `/usr/local/libexec/openshell`, and `/usr/local/libexec`, then next to the gateway binary. -When no driver is selected, the gateway tries Kubernetes, then Podman, then Docker. For Podman and Docker it starts the driver with the operator's table, so a configured `socket_path` is honored. The first driver that binds its socket is kept and configured, so detection never starts a driver it then stops. For Docker it does the same with the Docker table. A table that is invalid, or a socket that is not reachable, moves detection to the next candidate and logs the reason. A driver that crashes or times out stops startup. If a driver is selected by name, any such failure stops startup, except that Podman is started again a few times while its socket is unreachable, as the in-process driver retried. +When no driver is selected, the gateway tries Kubernetes, then Podman, then Docker. For Podman and Docker it starts the driver with the operator's table, so a configured `socket_path` is honored. The first driver that binds its socket is kept and configured, so detection never starts a driver it then stops. For Docker it does the same with the Docker table. A table that is invalid, or a socket that is not reachable, moves detection to the next candidate and logs the reason. A driver that crashes or times out stops startup. If a driver is selected by name, any such failure stops startup, except that the driver is started again up to six times, two seconds apart, while its backend is unreachable. On shutdown, the gateway stops sandboxes through each launched driver and then releases the driver with the launch protocol's `Shutdown` call. A driver defers a `SIGTERM` or `SIGINT` that reaches it from elsewhere, such as the signal a service manager sends to every process of the gateway's unit, until the gateway releases it, the gateway exits, or 30 seconds pass. Sandboxes therefore stop even when the whole unit is signalled. diff --git a/mise.lock b/mise.lock index ced14da38d..57d8afd484 100644 --- a/mise.lock +++ b/mise.lock @@ -69,6 +69,7 @@ url_api = "https://api.github.com/repos/EmbarkStudios/cargo-about/releases/asset [[tools."github:EmbarkStudios/cargo-deny"]] version = "0.20.2" backend = "github:EmbarkStudios/cargo-deny" +unsupported_platforms = ["windows-arm64"] [tools."github:EmbarkStudios/cargo-deny".options] version_prefix = "" @@ -355,31 +356,11 @@ url_api = "https://api.github.com/repos/norwoodj/helm-docs/releases/assets/17832 version = "5.8.3" backend = "aqua:k3d-io/k3d" -[tools.k3d."platforms.linux-arm64"] -checksum = "sha256:0b8110f2229631af7402fb828259330985918b08fefd38b7f1b788a1c8687216" -url = "https://github.com/k3d-io/k3d/releases/download/v5.8.3/k3d-linux-arm64" -url_api = "https://api.github.com/repos/k3d-io/k3d/releases/assets/229450023" - -[tools.k3d."platforms.linux-x64"] -checksum = "sha256:dbaa79a76ace7f4ca230a1ff41dc7d8a5036a8ad0309e9c54f9bf3836dbe853e" -url = "https://github.com/k3d-io/k3d/releases/download/v5.8.3/k3d-linux-amd64" -url_api = "https://api.github.com/repos/k3d-io/k3d/releases/assets/229450045" - [tools.k3d."platforms.macos-arm64"] checksum = "sha256:8da468daa7dc7cf7cdd4735f90a9bb05179fa27858250f62e3d8cdf5b5ca0698" url = "https://github.com/k3d-io/k3d/releases/download/v5.8.3/k3d-darwin-arm64" url_api = "https://api.github.com/repos/k3d-io/k3d/releases/assets/229450067" -[tools.k3d."platforms.windows-arm64"] -checksum = "sha256:655d2aadcb1f0a0dd196c5cbc564687ba945a9547c8e82c9fc532051fb260e22" -url = "https://github.com/k3d-io/k3d/releases/download/v5.8.3/k3d-windows-amd64.exe" -url_api = "https://api.github.com/repos/k3d-io/k3d/releases/assets/229450011" - -[tools.k3d."platforms.windows-x64"] -checksum = "sha256:655d2aadcb1f0a0dd196c5cbc564687ba945a9547c8e82c9fc532051fb260e22" -url = "https://github.com/k3d-io/k3d/releases/download/v5.8.3/k3d-windows-amd64.exe" -url_api = "https://api.github.com/repos/k3d-io/k3d/releases/assets/229450011" - [[tools.kubectl]] version = "1.36.1" backend = "aqua:kubernetes/kubernetes/kubectl" @@ -519,13 +500,6 @@ url = "https://storage.googleapis.com/skaffold/releases/v2.20.0/skaffold-linux-a checksum = "sha256:73478a431c17674d2f75d2c6e2fcbf35aa019de4ad6027e5573cc0f581767fbc" url = "https://storage.googleapis.com/skaffold/releases/v2.20.0/skaffold-darwin-arm64" -[tools.skaffold."platforms.windows-arm64"] -url = "https://storage.googleapis.com/skaffold/releases/v2.20.0/skaffold-windows-arm64.exe" - -[tools.skaffold."platforms.windows-x64"] -checksum = "sha256:a257da2988782b4c1971bb58b9c7bb52176f8a0b587b6520dec0064f271fa416" -url = "https://storage.googleapis.com/skaffold/releases/v2.20.0/skaffold-windows-amd64.exe" - [[tools.uv]] version = "0.10.12" backend = "aqua:astral-sh/uv" From 9d649ba6fa8667906c951f34166a6ac0d7ad828d Mon Sep 17 00:00:00 2001 From: Eric Curtin Date: Sat, 28 Nov 2026 10:12:32 +0000 Subject: [PATCH 2/2] fix(gateway): restore accidental mise.lock change Signed-off-by: Eric Curtin --- mise.lock | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/mise.lock b/mise.lock index 57d8afd484..ced14da38d 100644 --- a/mise.lock +++ b/mise.lock @@ -69,7 +69,6 @@ url_api = "https://api.github.com/repos/EmbarkStudios/cargo-about/releases/asset [[tools."github:EmbarkStudios/cargo-deny"]] version = "0.20.2" backend = "github:EmbarkStudios/cargo-deny" -unsupported_platforms = ["windows-arm64"] [tools."github:EmbarkStudios/cargo-deny".options] version_prefix = "" @@ -356,11 +355,31 @@ url_api = "https://api.github.com/repos/norwoodj/helm-docs/releases/assets/17832 version = "5.8.3" backend = "aqua:k3d-io/k3d" +[tools.k3d."platforms.linux-arm64"] +checksum = "sha256:0b8110f2229631af7402fb828259330985918b08fefd38b7f1b788a1c8687216" +url = "https://github.com/k3d-io/k3d/releases/download/v5.8.3/k3d-linux-arm64" +url_api = "https://api.github.com/repos/k3d-io/k3d/releases/assets/229450023" + +[tools.k3d."platforms.linux-x64"] +checksum = "sha256:dbaa79a76ace7f4ca230a1ff41dc7d8a5036a8ad0309e9c54f9bf3836dbe853e" +url = "https://github.com/k3d-io/k3d/releases/download/v5.8.3/k3d-linux-amd64" +url_api = "https://api.github.com/repos/k3d-io/k3d/releases/assets/229450045" + [tools.k3d."platforms.macos-arm64"] checksum = "sha256:8da468daa7dc7cf7cdd4735f90a9bb05179fa27858250f62e3d8cdf5b5ca0698" url = "https://github.com/k3d-io/k3d/releases/download/v5.8.3/k3d-darwin-arm64" url_api = "https://api.github.com/repos/k3d-io/k3d/releases/assets/229450067" +[tools.k3d."platforms.windows-arm64"] +checksum = "sha256:655d2aadcb1f0a0dd196c5cbc564687ba945a9547c8e82c9fc532051fb260e22" +url = "https://github.com/k3d-io/k3d/releases/download/v5.8.3/k3d-windows-amd64.exe" +url_api = "https://api.github.com/repos/k3d-io/k3d/releases/assets/229450011" + +[tools.k3d."platforms.windows-x64"] +checksum = "sha256:655d2aadcb1f0a0dd196c5cbc564687ba945a9547c8e82c9fc532051fb260e22" +url = "https://github.com/k3d-io/k3d/releases/download/v5.8.3/k3d-windows-amd64.exe" +url_api = "https://api.github.com/repos/k3d-io/k3d/releases/assets/229450011" + [[tools.kubectl]] version = "1.36.1" backend = "aqua:kubernetes/kubernetes/kubectl" @@ -500,6 +519,13 @@ url = "https://storage.googleapis.com/skaffold/releases/v2.20.0/skaffold-linux-a checksum = "sha256:73478a431c17674d2f75d2c6e2fcbf35aa019de4ad6027e5573cc0f581767fbc" url = "https://storage.googleapis.com/skaffold/releases/v2.20.0/skaffold-darwin-arm64" +[tools.skaffold."platforms.windows-arm64"] +url = "https://storage.googleapis.com/skaffold/releases/v2.20.0/skaffold-windows-arm64.exe" + +[tools.skaffold."platforms.windows-x64"] +checksum = "sha256:a257da2988782b4c1971bb58b9c7bb52176f8a0b587b6520dec0064f271fa416" +url = "https://storage.googleapis.com/skaffold/releases/v2.20.0/skaffold-windows-amd64.exe" + [[tools.uv]] version = "0.10.12" backend = "aqua:astral-sh/uv"