gvisor-empty-execstart
Fixes Rastrillo demos dying at start under gVisor (dev demo box-1, gvisor ON).
Cause: systemd connects StandardOutput=file: once per command. The gVisor run unit's ExecStartPre (runsc delete -force) connects to the log socket before ExecStart (runsc run). The agent's log listener (internal/activator/loglistener.go) tees only the first connection and closes later ones unread, so the guest's stdout/stderr was a closed socket. Its first log write (Rastrillo logs "rastrillo: serving" right after binding app.sock) got EPIPE, SIGPIPE killed it, 141 is a SuccessExitStatus, so systemd logged "Deactivated successfully" and the wake failed 30 s later with app.sock connection refused.
Not a v0.34.46 regression: latent since de380c2c. Every earlier gVisor start that worked was the silent witness starter (internal/console/testdata/demo), which writes nothing before serving.
Change: on a gVisor box the run role's log listener tees every connection of the invocation (bounded at 8). The systemd family is unchanged.
The empty ExecStart= in carlos-instance-gvisor@.service is by design (the drop-in supplies it; assertGVisorUnit checks it before every start). New test pins that the drop-in always sets exactly one non-empty runsc command.
Tests (targeted, TMPDIR=/tmp/g, sandbox off for sockets):
- TestGVisorRunLogListenerTeesTheMainProcessAfterExecStartPre: FAILED before the prepare change (connection reset by peer), passes after.
- TestSystemdRunLogListenerStillRefusesASecondConnection, TestLogListenerEachRefusesPastItsBound, existing TestLogListener and AppLinesName*: pass (-race -count=3).
- TestGVisorDropInAlwaysSetsOneNonEmptyExecStart, TestGVisorFix1StaleStateRecipe: pass.
- TestPlan14RootReadCensus, TestCensusScopeIsTheRootBinary: pass with overlay gvisor-empty-execstart.
Review: Astra code review of f0ec79c9, no findings in the commit (~/.cache/gvisor-execstart-review/astra.md). Its one pre-existing weakness (the tee closes the app's stdout when the agent's stdout write fails) is filed as #936, not fixed here.
Census (#280, reviewer Astra): round 1 approved the prepareKeyedAt body and rejected the activator envelope on one P2, an atomic.Int32 admission counter that counted refused connections and could wrap after 2^31. Fixed in b67319de: admission is a plain int owned by the accept loop that grows only on admission (admit), with TestLogListenerAdmissionStaysExhausted. Round 2 on b67319de: P2 resolved, CENSUS: APPROVED. Activator package and the census tests pass locally.
Next: squash to main, release v0.34.47 (8a3d302's numbering), dev canary only, then dev demo box-1 back to gvisor and a Rastrillo witness.
Discussions
- No discussions on this branch yet.
Tasks
- No tasks yet.
Activity
- paul@keymail.dev pushed f32ca3a98 Merge remote-tracking branch 'origin/main' into HEAD
- paul@keymail.dev pushed b67319dea activator: log listener admission stops at its limit
- paul@keymail.dev pushed f0ec79c9f activator: tee every log connection of a gVisor run unit