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
want sled-agent timeout on completion of requests to stop a Propolis VM #4004
Today, requests to stop a running instance must by necessity involve the instance's active Propolis (sled agent sends the stop request to Propolis; the instance is stopped when Propolis says so, at which point sled agent cleans up the Propolis zone and all related objects). If an instance's Propolis is not responding, or there is no active Propolis, there is no obvious way to clean up the instance and recover.
A short-term workaround is to grant some form of API access to sled agent's "unregister instance" API, which forcibly executes the termination path (tearing down the Propolis zone and removing the instance from the sled's instance table) and can get force an instance into a stopped state.
In the long run instance lifecycle management needs to be made more robust to Propolis failure and/or non-responsiveness.
changed the title [-]Instance stop doesn't work if Propolis panics or is unreachable[/-][+]Want mechanism to forcibly remove an instance's active VMMs irrespective of instance state[/+]on Oct 6, 2023
In #4194, sled agent's "instance unregister" API assumes that it can produce the correct posterior VMM and instance states by emulating a "Propolis destroyed" state transition. (That is, sled agent's "rudely terminate this instance" function computes the next state by pretending that it immediately got a message from the current VMM that says "I am destroyed and my current migration has failed.")
This is fine today because the unregister API is only used when unwinding start and migrate sagas, where the VMMs that are subject to unregistration have by definition not gotten to do anything interesting yet. It's less fine if Propolis has already begun to run, and especially not fine if we're force-quitting an instance that's a migration target:
Source and target VMMs agree that migration is done
Just before they tell their respective sled agents, Nexus shows up and rudely terminates the source
The emulated "VMM destroyed, migration failed" transition retires the source and the migration, which makes it possible to start the instance again...
...but the target might actually begin to run while this is happening!
This seems dangerous. We probably want to adjust the synchronization here to be something more like the following:
Nexus "disowns" a particular VMM, e.g. by replacing its ID in an instance record with a zeroed ID (or some other set of sentinel values that prevents the instance from restarting)
Nexus terminates all of the disowned VMMs
Nexus clears out the sentinels to allow the instance to start again
This would need to be done in a saga to ensure the whole process runs to completion. More design work's needed here. We just need to do that work before we hook up any external APIs to the existing instance_ensure_unregistered sled agent interface.
#6915 and #6913 solved (at least a subset) of problems related to killing instances that are in a stuck state, so now the normal shutdown API in sled-agent should basically be equivalent to force-shutdown as far as we are capable of having such a thing. I think this probably ought to be closed; what do you think @gjcolombo?
Instead, we might consider just making the system resilient to Propolis getting stuck or misbehaving whilst shutting down
I thought we still needed to deal with this part (i.e., if Propolis is stuck in Starting or Stopping, then a request to stop its instance won't resolve). I think we should have an issue (this one or another one) tracking that behavior, since there's currently no other way to deal with an instance that's wedged waiting for Crucible activation (though that specific case might be resolvable by other means, see oxidecomputer/propolis#841).
@gjcolombo sorry I missed your reply from earlier. Just to clarify, is this:
I thought we still needed to deal with this part (i.e., if Propolis is stuck in Starting or Stopping, then a request to stop its instance won't resolve). I think we should have an issue (this one or another one) tracking that behavior...
a change in Propolis, or in Omicron?
As I understand it, Nexus will happily send a stop request to sled-agent for an instance that's Starting, but I believe that the the sled-agent's only way of handling that request is to send a HTTP request to Propolis. As of #6915, the sled-agent should send that request immediately even if it's waiting on an outstanding request to perform some other operation. But, I'm not sure off the top of my head whether Propolis will be able to handle that request if it's waiting for Crucible activation.
Is my understanding correct? If so, it seems to me that maybe we should close this and go open a Propolis ticket about prioritizing requests to terminate...or, we should give the sled-agent a way to tear down the Propolis zone violently should it fail to handle a shutdown request.
We checked in on this in today's hypervisor huddle. I believe the consensus was that
sled agent should have a timeout (a long timeout, on the order of several minutes, but a timeout) on requests to stop a Propolis VM; if the timeout expires before the VM enters the Destroyed state, sled agent should rudely terminate the Propolis zone and move the instance to failed; and
we should still aim to fix propolis#841 as soon as possible, since this is the primary issue causing instances to get into a state where one would rely on this kind of timeout.
changed the title [-]Want mechanism to forcibly remove an instance's active VMMs irrespective of instance state[/-][+]want sled-agent timeout on completion of requests to stop a Propolis VM[/+]on Feb 13, 2025
I believe I found another way to trigger this situation.
If you expunge a sled with running instances, then those instances are auto-restarted on a new sled.
That start can race with downstairs repair, and if an instance is started first, it will have an old VCR (that needs repair).
The instance with the old VCR won't be able to activate because one of the three downstairs is now missing.
So, no activation, and that means propolis can't act on any repair request that nexus sends it.
Okay, I put together a quick pass on the shutdown timeout: #7548
I still need to actually test that this handles the cases we care about before merging that PR, but I'm pretty sure the timeout should cover the entire shutdown process, starting from when we send the PUT to Propolis with the Stopped state.
Activity
jordanhendricks commentedon Sep 25, 2023
Related: #3209
[-]Instance stop doesn't work if Propolis panics or is unreachable[/-][+]Want mechanism to forcibly remove an instance's active VMMs irrespective of instance state[/+]gjcolombo commentedon Oct 6, 2023
In #4194, sled agent's "instance unregister" API assumes that it can produce the correct posterior VMM and instance states by emulating a "Propolis destroyed" state transition. (That is, sled agent's "rudely terminate this instance" function computes the next state by pretending that it immediately got a message from the current VMM that says "I am destroyed and my current migration has failed.")
This is fine today because the unregister API is only used when unwinding start and migrate sagas, where the VMMs that are subject to unregistration have by definition not gotten to do anything interesting yet. It's less fine if Propolis has already begun to run, and especially not fine if we're force-quitting an instance that's a migration target:
This seems dangerous. We probably want to adjust the synchronization here to be something more like the following:
This would need to be done in a saga to ensure the whole process runs to completion. More design work's needed here. We just need to do that work before we hook up any external APIs to the existing
instance_ensure_unregisteredsled agent interface.davepacheco commentedon Jan 26, 2024
Also related: #4872
Perform instance state transitions in `instance-update` saga (#5749)
8 remaining items
hawkw commentedon Jan 30, 2025
#6915 and #6913 solved (at least a subset) of problems related to killing instances that are in a stuck state, so now the normal shutdown API in sled-agent should basically be equivalent to force-shutdown as far as we are capable of having such a thing. I think this probably ought to be closed; what do you think @gjcolombo?
gjcolombo commentedon Feb 1, 2025
I thought we still needed to deal with this part (i.e., if Propolis is stuck in
StartingorStopping, then a request to stop its instance won't resolve). I think we should have an issue (this one or another one) tracking that behavior, since there's currently no other way to deal with an instance that's wedged waiting for Crucible activation (though that specific case might be resolvable by other means, see oxidecomputer/propolis#841).hawkw commentedon Feb 11, 2025
@gjcolombo sorry I missed your reply from earlier. Just to clarify, is this:
a change in Propolis, or in Omicron?
As I understand it, Nexus will happily send a stop request to sled-agent for an instance that's
Starting, but I believe that the the sled-agent's only way of handling that request is to send a HTTP request to Propolis. As of #6915, the sled-agent should send that request immediately even if it's waiting on an outstanding request to perform some other operation. But, I'm not sure off the top of my head whether Propolis will be able to handle that request if it's waiting for Crucible activation.Is my understanding correct? If so, it seems to me that maybe we should close this and go open a Propolis ticket about prioritizing requests to terminate...or, we should give the sled-agent a way to tear down the Propolis zone violently should it fail to handle a shutdown request.
gjcolombo commentedon Feb 13, 2025
We checked in on this in today's hypervisor huddle. I believe the consensus was that
[-]Want mechanism to forcibly remove an instance's active VMMs irrespective of instance state[/-][+]want sled-agent timeout on completion of requests to stop a Propolis VM[/+]leftwo commentedon Feb 13, 2025
I believe I found another way to trigger this situation.
If you expunge a sled with running instances, then those instances are auto-restarted on a new sled.
That start can race with downstairs repair, and if an instance is started first, it will have an old VCR (that needs repair).
The instance with the old VCR won't be able to activate because one of the three downstairs is now missing.
So, no activation, and that means propolis can't act on any repair request that nexus sends it.
[sled-agent] VMM graceful shutdown timeout
hawkw commentedon Feb 14, 2025
Okay, I put together a quick pass on the shutdown timeout: #7548
I still need to actually test that this handles the cases we care about before merging that PR, but I'm pretty sure the timeout should cover the entire shutdown process, starting from when we send the PUT to Propolis with the
Stoppedstate.[sled-agent] VMM graceful shutdown timeout
[sled-agent] VMM graceful shutdown timeout (#7548)