You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sled agent should terminate Propolis zones when Propolis indicates a previously-started VM has gone missing #3209
Sled AgentRelated to the Per-Sled Configuration and ManagementbugSomething that isn't working.known issueTo include in customer documentation and trainingvirtualizationPropolis Integration & VM Management
a new propolis-server ran, and requests from the serial console in the web console continued, but there was no instance, so the console seemed to hang
It isn't clear to me that restarting propolis-server is the right thing to do here. We should consider having the service go into maintenance and not restart when that happens.
Because the propolis-server process owns userspace VMM state that isn't really persisted anywhere, it's more or less impossible to recover a VM in a usable state after a restart, so restarting the propolis-server process is basically never correct. When a propolis-server comes back up, it won't know about the VM it will have previously managed, and there's no way for it to resume managing that VM correctly as a bunch of state that only exists in userspace is gone. @gjcolombo and I talked it over today and we agreed that we should change this to never restart propolis-server.
We discussed this at the 9/26/24 hypervisor huddle. The thing we want to get right here is that when a Propolis zone panics, sled agent should be able to discover as much and then should (a) move the VMM to Failed, (b) terminate the zone, and (c) ensure that a bundle is taken that includes logs and the panic core.
(b) and (c) happen naturally as part of sled agent's existing "VMM terminated" logic, and (a) is trivial once the zone is gone (or, more precisely, once sled agent stops watching for updates from the relevant propolis-server). The main issue, then, is making sure that sled agent properly detects that Propolis was terminated and restarted.
Fortunately, when a client asks Propolis to do something that requires an active VM, Propolis will return a unique "VM? what VM?" error code if no VM is present. This means that sled agent should be able to detect Propolis restarts: if it knows that it previously started a VM in a Propolis server, and now the server says there's no VM there, then the whole enterprise has failed and sled agent should clean up accordingly.
changed the title [-]consider not restarting propolis-server after failure[/-][+]sled agent should terminate Propolis zones when Propolis indicates a previously-started VM has gone missing[/+]on Sep 27, 2024
Thanks @gjcolombo for renaming this one --- I think the new title is much better. I investigated what we're currently doing in sled-agent in #3238 (comment), and the TL;DR is "it's still pretty bad": the error code Propolis returns when it's been restarted is blindly passed up to Nexus (which isn't terrible, it's at least not a 500 anymore), but Nexus doesn't know what it means, and sled-agent doesn't actually clean up the zone in that case. So I'm gonna go fix that.
// Update the generation number we're asking for, to ensure the
// Propolis will only return more recent values.
gen = observed_gen + 1;
}
}
}
We would expect this to drop the send-side of the channel it uses to communicate with the InstanceRunner, closing the channel, and hitting this select, which would correctly mark the VMM as failed and do what we want, despite eating the actual error message from propolis:
// Request channel on which monitor requests are made.
tx_monitor: mpsc::Sender<InstanceMonitorRequest>,
AFAICT, this means we'll just totally give up on monitoring the instance as soon as we hit any error here, which seems...quite bad. I think that this actually means that when a Propolis process crashes unexpectedly, we'll get an error when the TCP connection closes, bail out, and then never try hitting the instance monitor endpoint ever again1. So, we won't notice that the Propolis is actually out to lunch until we try to ask it to change state. This Is Not Great!
We should probably rework this so that the InstanceMonitorRunner will proactively send any errors which definitively indicate goneness to the InstanceRunner, and just keep trying in the face of any other errors (at least, connection errors), probably with a smallish backoff.
Footnotes
Although I've not actually verified that this is what happens. ↩
Sled AgentRelated to the Per-Sled Configuration and ManagementbugSomething that isn't working.known issueTo include in customer documentation and trainingvirtualizationPropolis Integration & VM Management
Activity
davepacheco commentedon Feb 20, 2024
Maybe related to #4872?
hawkw commentedon Feb 20, 2024
Because the
propolis-serverprocess owns userspace VMM state that isn't really persisted anywhere, it's more or less impossible to recover a VM in a usable state after a restart, so restarting thepropolis-serverprocess is basically never correct. When apropolis-servercomes back up, it won't know about the VM it will have previously managed, and there's no way for it to resume managing that VM correctly as a bunch of state that only exists in userspace is gone. @gjcolombo and I talked it over today and we agreed that we should change this to never restartpropolis-server.1 remaining item
gjcolombo commentedon Sep 27, 2024
We discussed this at the 9/26/24 hypervisor huddle. The thing we want to get right here is that when a Propolis zone panics, sled agent should be able to discover as much and then should (a) move the VMM to Failed, (b) terminate the zone, and (c) ensure that a bundle is taken that includes logs and the panic core.
(b) and (c) happen naturally as part of sled agent's existing "VMM terminated" logic, and (a) is trivial once the zone is gone (or, more precisely, once sled agent stops watching for updates from the relevant propolis-server). The main issue, then, is making sure that sled agent properly detects that Propolis was terminated and restarted.
Fortunately, when a client asks Propolis to do something that requires an active VM, Propolis will return a unique "VM? what VM?" error code if no VM is present. This means that sled agent should be able to detect Propolis restarts: if it knows that it previously started a VM in a Propolis server, and now the server says there's no VM there, then the whole enterprise has failed and sled agent should clean up accordingly.
[-]consider not restarting propolis-server after failure[/-][+]sled agent should terminate Propolis zones when Propolis indicates a previously-started VM has gone missing[/+]hawkw commentedon Sep 27, 2024
Thanks @gjcolombo for renaming this one --- I think the new title is much better. I investigated what we're currently doing in sled-agent in #3238 (comment), and the TL;DR is "it's still pretty bad": the error code Propolis returns when it's been restarted is blindly passed up to Nexus (which isn't terrible, it's at least not a 500 anymore), but Nexus doesn't know what it means, and sled-agent doesn't actually clean up the zone in that case. So I'm gonna go fix that.
hawkw commentedon Sep 27, 2024
Good news, the propolis-server
InstanceStateMonitorAPI will also return the error codes we want from it (which, it turns out, I had added, but I forgot about): https://github.com/oxidecomputer/propolis/blob/dfcd4430f0211160c9fffd4688d1be556296c769/bin/propolis-server/src/lib/server.rs#L389-L418Bad news, the sled-agent
InstanceMonitorRunnerwill just bail out on receipt of any error from Propolis:omicron/sled-agent/src/instance.rs
Lines 253 to 289 in 888f6a1
We would expect this to drop the send-side of the channel it uses to communicate with the
InstanceRunner, closing the channel, and hitting this select, which would correctly mark the VMM as failed and do what we want, despite eating the actual error message from propolis:omicron/sled-agent/src/instance.rs
Lines 388 to 394 in 888f6a1
HOWEVER, as the comment points out, the
InstanceRunneris also holding its own clone of the channel sender, keeping us from ever hitting that case:omicron/sled-agent/src/instance.rs
Lines 308 to 309 in 888f6a1
AFAICT, this means we'll just totally give up on monitoring the instance as soon as we hit any error here, which seems...quite bad. I think that this actually means that when a Propolis process crashes unexpectedly, we'll get an error when the TCP connection closes, bail out, and then never try hitting the instance monitor endpoint ever again1. So, we won't notice that the Propolis is actually out to lunch until we try to ask it to change state. This Is Not Great!
We should probably rework this so that the
InstanceMonitorRunnerwill proactively send any errors which definitively indicate goneness to theInstanceRunner, and just keep trying in the face of any other errors (at least, connection errors), probably with a smallish backoff.Footnotes
Although I've not actually verified that this is what happens. ↩
hawkw commentedon Sep 27, 2024
retagging this one as "bug" because it's turned out that this is kinda bad and i'm going to make fixing it my top priority.
[sled-agent] Unbreak handling of Propolis error codes (#6726)
[sled-agent] Unbreak handling of Propolis error codes (#6726)