Wait for local Supervisor startup during svc load - #10388
Wait for local Supervisor startup during svc load#10388officialasishkumar wants to merge 2 commits into
Conversation
|
Hello officialasishkumar! Thanks for the pull request! Here is what will happen next:
Thank you for contributing! |
There was a problem hiding this comment.
Pull request overview
This PR improves hab svc load behavior when targeting a local Supervisor whose control gateway is temporarily unavailable during startup, by detecting a recent Supervisor LOCK file and retrying briefly instead of immediately failing with a generic connection-refused error.
Changes:
- Add
gateway_util::send_waiting_for_startupto retry on localConnectionRefusedwhen a recent SupervisorLOCKfile suggests startup is in progress. - Emit a one-time warning while waiting, then retry until success or a startup-wait timeout.
- Update
hab svc load(CLI v4) to use the new startup-waiting send path and add unit tests for lock-file detection logic.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| components/hab/src/gateway_util.rs | Adds local-startup wait/retry logic keyed off a recent Supervisor LOCK file, plus unit tests. |
| components/hab/src/cli_v4/svc/load.rs | Routes hab svc load through the new startup-waiting gateway helper. |
|
|
||
| loop { | ||
| match send(remote_sup_addr, msg.clone()).await { | ||
| Err(crate::error::Error::CtlClient(SrvClientError::ConnectionRefused)) | ||
| if should_wait_for_local_supervisor_startup(remote_sup_addr, start.elapsed()) => | ||
| { | ||
| if !warned { | ||
| let mut ui = UI::default_with_env(); | ||
| let _ = ui.warn("The local Supervisor is not accepting commands yet; \ | ||
| waiting for it to finish starting."); | ||
| warned = true; | ||
| } | ||
| tokio::time::sleep(SUPERVISOR_STARTUP_RETRY_INTERVAL).await; |
There was a problem hiding this comment.
Addressed in c4ef262: the lock-file freshness check is evaluated once, and retries are then gated by the startup wait window.
| assert!(has_recent_supervisor_lock_file(&lock_file, Duration::from_secs(60))); | ||
| assert!(!has_recent_supervisor_lock_file(&lock_file, Duration::ZERO)); | ||
| } |
There was a problem hiding this comment.
Addressed in c4ef262: replaced the Duration::ZERO assertion with a small positive threshold after a short sleep.
Retry hab svc load while a local Supervisor lock file indicates startup is in progress. The command now warns once and waits briefly for the control gateway instead of immediately returning a connection-refused error.
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
46d1b68 to
c4ef262
Compare
Summary
hab svc loadretry briefly when the local Supervisor control gateway refuses connections while a recent SupervisorLOCKfile indicates startup is in progress.Testing
GIT_CONFIG_GLOBAL=/dev/null CARGO_NET_GIT_FETCH_WITH_CLI=true cargo test -p hab gateway_utilFixes #6301.