Run a process broker per agent-host view - #371
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plan row 9c, PR A (lane L5r,
briefs/l5r-broker-cgroup.md). The agent host runs one process broker per view, so a Harness's shims run their programs in the sandbox. It also fixes thesessionview.Starthang that #348 names as a residual.agenthost
ownstarts aprocessbrokerwithView.Relay()aftersessionview.Start. The view's end path closes it afterWaitand before the slot is released. TheprocessBrokerseam and the Session-level broker are gone.Executablesmaps each shim name and shim path to itself.Environmentis the view'sForwardEnvplus the Session's Sandbox and Tool values.CancelGraceis the launch's kill timeout.Dialopens a Process stream on the Session's attachment.Scopeis the strongest scope the Process service declares (ScopeCgroupV2, thenScopePOSIXSession), read withDescribebefore each launch whose view declares shims. If neither is declared, the Session fails withErrProcessBroker.Donefires while the view runs, the watcher sends the viewSignal(0). A delivered signal means the relay was lost while the Harness ran, and the Session fails withErrProcessBrokerwrappingprocessbroker.ErrRelayLost. A failed signal means the view is already ending, because sessionview ends the relay connection only in its teardown.Waitthen reports how.PATHin the Environment's Sandbox or Tool values. Without it, admission rejects the Session withErrInvalidSession, before any effect.sessionview.ErrCleanupfromStartorWaitfails the Session asErrTeardown. Teardown then keeps the Session directory and uid, as a failedExecutor.Closealready does, because the view's processes may still run.sessionview
Checks
go build ./...andgo vet ./...../apps/... ./internal/.... The windows build failure inservices/corepredates this branch.go test -race -count=1on agenthost, sessionview and processbroker.OAC_TEST_AGENTHOST=1: all tests pass, including two new subtests. In one, a command run through the shim in the sandbox gives the Harness42and exit code 3. In the other, killing the relay fails the Session withErrRelayLost.OAC_TEST_SESSIONVIEW=1: all 8 tests pass, includingTestCancelledStartStopsTheWorld, which fails without the fix.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.