8000 sandbox2: the sandbox leader should own its namespace, not the creating process · Issue #1001 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

sandbox2: the sandbox leader should own its namespace, not the creating process #1001

Closed

Description

@norrietaylor

Goal

Make a sandbox's leader process the owner of its namespace, and record that
leader's pid where the sandbox directory can be reclaimed against it. Today the
directory records the pid of whatever process created it, which is not the
process whose lifetime the sandbox actually tracks.

Why it matters

crates/sandbox2/src/config.rs names each sandbox directory
{name}-{timestamp}-{attempt}-{pid} from std::process::id() — the creator.

  • Under the CLI that happens to work: mip creates the sandbox and lives
    roughly as long as it, so when mip exits the pid dies and the directory is
    reclaimable. mip cache clean relies on exactly this
    (crates/mip/src/cmd_cache.rs, cleanup_stale).
  • Under the daemon it does not. minimald creates the sandbox and outlives
    it, so the recorded pid stays alive for the daemon's whole life. Inside the
    microVM minimald is pid 1, so every sandbox directory is stamped -1
    and /proc/1 exists by definition — including across daemon restarts, where
    the new daemon is pid 1 too.

Observed directly on a booted VM: every directory under the build base carried
-1, e.g. build-1784239277-0-1.

Activity

  1. added
    kind:feature
    on Jul 28, 2026
  2. transferred this issue fromon Jul 28, 2026
  3. added
    priority:should-have
    on Jul 28, 2026
  4. norrietaylor commented on Jul 28, 2026

    @norrietaylor
    MemberAuthor

    Note on the deferral half, prompted by a question on #1002: ListSessions already carries a usable liveness and activity signal, and it is a better basis than the pid scan this issue replaces.

    • Liveness: ListSessionsEntry.attrs is Some only for sessions the manager has a running actor for (crates/minimald/src/sessions.rs, List arm). attrs.is_some() is therefore a true live-host check, orthogonal to the record's status — an Active record with attrs: None is a known-but-dormant session.
    • Activity: last_stdout / last_stdin, from HostAttrs.stdout_last/stdin_last. Real recorded timestamps, not a proxy like directory mtime. This is what min ls renders as LAST ACTIVITY.
    • Not available: session time alive. Neither HostAttrs nor sessions::Record records a start time; the only uptime in the system is the VM's (minvmd status --json → uptime_seconds, from State.started_at). Adding one would be a Record field.

    Worth being explicit that session liveness is the wrong predicate on its own: a long-lived attached session is the steady state, so deferring on it would suppress maintenance permanently on exactly the hosts that need it — the same failure mode as the pid-1 defect, differently caused. Activity recency is the usable form.

    The leader-pid work in this issue remains what answers "is a build in flight". The two signals are complementary rather than alternatives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

kind:featurepriority:should-haverouted

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    0