Restart apps stranded by an in-place sidecar restart (#149) #17
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
symphony
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
backmeupplz/myground!17
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/149-sidecar-restart-rejoin"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes agentboard #149.
Problem
An app with
network_mode: service:ts-sidecar(orservice:gluetun) runs ascontainer:<owner id>. When the owner restarts in place (same ID, via itsunless-stoppedpolicy orcompose restart ts-sidecar, whichregenerate_all_serve_configsalso does), it gets a fresh network namespace. The app stays in the old one, so it still reports healthy while the sidecar's proxy getsconnection refusedand the app goes dark. This happened to vaultwarden on 2026-10-20.Fix
src/netns.rsadds a watchdog, spawned next to the scheduler inserve(). Every 30s it:myground-*ones whoseHostConfig.NetworkModeiscontainer:<id>with a running owner;State.StartedAtfor each dependent and owner;Owners that are missing or stopped are skipped, because a restart can't rejoin them. Unknown start times are skipped too. After a restart, the dependent's start time is later than the owner's, so it can't loop.
Tests
cargo test: all suites pass (lib 309, api_tests 83, …).netns::testscover parsing, the stranded/not-stranded decision, the grace period and unknown times.tests/netns_e2e.rs(ignored by default,cargo test --test netns_e2e -- --ignored) runs a busybox owner+app pair. It restarts the owner, checks that the app is unreachable from the owner's namespace, runs the watchdog and checks that the app is reachable again and isn't restarted a second time. It passed locally on Docker Desktop.Version bumped to 0.1.105.