fix: transient state leak via RAII guard
bare set_transient/clear_transient pairs leak the in-memory transient on task cancellation, panics, or any early return between the two calls — dashboard then shows the agent stuck in 'rebuilding…' forever (coder hit this today). add Coordinator::transient_guard returning a TransientGuard whose Drop clears, and convert every caller (dashboard lifecycle_action, auto_update::rebuild_agent, manager_server Update, actions::destroy, actions Spawn task, migrate phase 4). destroy() now takes &Arc<Coordinator> so it can hold a guard. existing stuck transients clear on next hive-c0re restart since transient state is in-memory only.
This commit is contained in:
parent
1a36c38a54
commit
313121a6e9
6 changed files with 56 additions and 18 deletions
|
|
@ -1125,9 +1125,9 @@ where
|
|||
Fut: std::future::Future<Output = anyhow::Result<()>>,
|
||||
{
|
||||
let logical = strip_container_prefix(name);
|
||||
state.coord.set_transient(&logical, kind);
|
||||
let _guard = state.coord.transient_guard(&logical, kind);
|
||||
let result = body(logical.clone()).await;
|
||||
state.coord.clear_transient(&logical);
|
||||
drop(_guard);
|
||||
match result {
|
||||
Ok(()) => {
|
||||
extra(state, &logical);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue