Repository navigation
Conversation
There's currently a bug in `sled-agent`'s `InstanceRunner` where a request to stop a VMM that has not yet started will fall through into code that asserts there is a running Propolis zone, and panic. This was pointed out by @jgallagher in a review of #11380. The bug existed long before that change, but we've apparently never managed to trigger it (?). However, a race here may become likelier after #11380 merges, since the control plane will request that starting VMMs stop. This commit adds a regression test for this, and then fixes the bug by returning early in this case rather than falling through into the panic. Fixes #11536
|
@claude review |
There was a problem hiding this comment.
LGTM. This is a small, correct fix for the panic when a VMM is stopped before it has started.
What was reviewed:
- The
Stoppedarm ofput_state. Before this change,(None, None)fell through toassert!(self.running_state.is_some())and panicked. The only steps the early return now skips are that assert and two no-ops (propolis_request/next_publishedwere bothNone). terminate()still runs before the return, so the zone is removed andterminator.completedis set. That is the same pattern as the existingfail_vmm_and_terminate+return Ok(self.state.sled_instance_state())path.- The new
test_stop_before_startchecks four things: the reply state is Destroyed, the runner requests removal, the published state is InstancePut/Destroyed, and the runner task exits cleanly.
Extended reasoning...
The change touches only sled-agent/src/instance.rs. It is a three-line control-flow change in InstanceRunner::put_state plus a new regression test. It touches no auth, crypto, or data-exposure surface. In the no-Propolis case, the old code could only reach an assert that always failed. The early return matches an existing pattern in the same function, the new test covers the case, and no CODEOWNERS file covers the path.
|
Looking slightly closer at this, I like the way @jmpesp's change just removes the assert, since there's already an unwrap in |
|
or i guess we could just merge James' PR and then this one could just add the regression test |
|
In the watercooler call I believe it was observed that James's PR eliminates this assertion failure but not a subsequent |
The and I do want to land the test regression test I added, though, since I think it's worth keeping that part. |
There's currently a bug in
sled-agent'sInstanceRunnerwhere a request to stop a VMM that has not yet started will fall through into code that asserts there is a running Propolis zone, and panic. This was pointed out by @jgallagher in a review of #11380. The bug existed long before that change, but we've apparently never managed to trigger it (?). However, a race here may become likelier after #11380 merges, since the control plane will request that starting VMMs stop.This commit adds a regression test for this, and then fixes the bug by returning early in this case rather than falling through into the panic.
Fixes #11536