Skip to content

Commit 7053acf

Browse files
committed
shuffle around who must take care to what
1 parent c05401b commit 7053acf

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

bin/propolis-server/src/lib/vm/ensure.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,6 @@ impl<'a> VmEnsureNotStarted<'a> {
256256
// When the runtime is returned to this thread, it must not be dropped.
257257
// That means that the path between this result and returning an
258258
// `Ok(VmEnsureObjectsCreated)` must be infallible.
259-
//
260-
// `VmEnsureObjectsCreated` (and later state transitions) take care to
261-
// `shutdown_background` the runtime.
262259
let result: InitResult = tokio::task::spawn_blocking(move || {
263260
// Create the runtime that will host tasks created by
264261
// VMM components (e.g. block device runtime tasks).
@@ -341,6 +338,12 @@ impl<'a> VmEnsureNotStarted<'a> {
341338
/// Represents an instance ensure request that has proceeded far enough to
342339
/// create a set of VM objects, but that has not yet installed those objects as
343340
/// an `ActiveVm` or notified the requestor that its request is complete.
341+
///
342+
/// WARNING: dropping `VmEnsureObjectsCreated` is a panic risk since dropping
343+
/// the contained `tokio::runtime::Runtime` on in a worker thread will panic. It
344+
/// is probably a bug to drop `VmEnsureObjectsCreated`, as it is expected users
345+
/// will quickly call [`VmEnsureObjectsCreated::ensure_active`], but if you
346+
/// must, take care in handling the contained `vmm_rt`.
344347
pub(crate) struct VmEnsureObjectsCreated<'a> {
345348
log: &'a slog::Logger,
346349
vm: &'a Arc<super::Vm>,

0 commit comments

Comments
 (0)