Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions nvx/src/host/cli/store/launch.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Locked launch transitions and bounded recovery of an interrupted launch.

use std::thread;
use std::time::{Duration, Instant};
use std::time::Instant;

use super::StateFile;
use super::files;
Expand All @@ -10,6 +10,7 @@ use super::record::{LaunchJournal, RuntimeRecord};
use crate::host::cli::deadline::RETRY_INTERVAL;
use crate::host::process::{BootId, KILL_TIMEOUT, Opened, Process, ProcessRef};
use crate::host::runtime::RuntimeIdentity;
use crate::host::sandbox::scratch::CLAIM_RELEASE_WAIT;
use crate::host::vm::{Prepared, SavedVm};
use crate::{Error, ErrorKind, Result};

Expand Down Expand Up @@ -73,9 +74,9 @@ impl LockedState {
}
}

/// Rechecks transient fork-inherited descriptors for at most one second.
/// Rechecks transient fork-inherited descriptors for at most [`CLAIM_RELEASE_WAIT`].
fn released_claim(&self, journal: &LaunchJournal, deadline: Instant) -> Result<bool> {
let until = deadline.min(Instant::now() + Duration::from_secs(1));
let until = deadline.min(Instant::now() + CLAIM_RELEASE_WAIT);
loop {
if !self.claim_held(journal)? {
return Ok(true);
Expand Down
4 changes: 3 additions & 1 deletion nvx/src/host/sandbox/scratch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ const SCRATCH_BINDING_VERSION: u32 = 1;

/// How long a check of a scratch image that should be free waits for its claim to be released:
/// long enough for a process that another thread of the caller spawned to execute its program,
/// and so to close its copy of a claim, as [Claims](self#claims) explains.
/// and so to close its copy of a claim, as [Claims](self#claims) explains. The sandbox store
/// waits as long for the claim on an interrupted launch's log, which such a process holds the
/// same way on Linux, and on Windows while the claim is the log's open handles.
pub(crate) const CLAIM_RELEASE_WAIT: Duration = Duration::from_secs(1);

/// How often a check tries a claim that is held again.
Expand Down
Loading