Repository navigation
Stop mav open --no-relaunch stacking a log stream per call - #119
Merged
Merged
Conversation
The probe-logs `log stream` is meant to outlive `open`: it captures for
the whole run and is reaped by `mav stop` or the run worker. Plain `mav
open` holds to that -- it records the run it supersedes and stops it on
the way in, so exactly one stream is ever alive.
`--no-relaunch` did not. It has no bound run and REUSES the current one,
so nothing superseded the old stream, and the stopProbeLogs call that
would have killed it was guarded by hasBoundRun -- against what its own
comment already said ("this applies regardless of --no-relaunch ... must
always be stopped first"). Every invocation left another live process,
reaped only when the lease was released.
Measured, four `mav open --no-relaunch` in a row, counting live recorded
probe-logs PIDs:
before 1, 2, 3, 4
after 1, 1, 1, 1
Plain `mav open` measured the same way stays at 1 on both sides.
The guard is gone; on a fresh run there is nothing recorded, so the call
is a no-op there. The test owns its own simulator UDID because the sim
lock is a global file keyed by UDID and the shared "SIM" makes a second
open fail with sim_locked for reasons that have nothing to do with logs.
Claude-Session: https://claude.ai/code/session_018Qmew9oEQ6frPLSrE8XUm5
goto_tree_cache_test.go belongs to work in flight in another branch and has nothing to do with the log-stream leak. It reached the previous commit through a stale staged entry, not deliberately. Removed from the branch only; the file on disk is untouched. Claude-Session: https://claude.ai/code/session_018Qmew9oEQ6frPLSrE8XUm5
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.
The probe-logs
log streamis supposed to outliveopen— it captures for the whole run and is reaped bymav stopor the run worker. That is not the bug. The bug is that one path started a new one without stopping the old.Plain
mav openis fine: it records the run it supersedes and stops it on the way in, so exactly one stream is ever alive.mav open --no-relaunchwas not. It has no bound run and reuses the current one, so nothing supersedes it — and thestopProbeLogscall that would have killed the previous stream was wrapped inif hasBoundRun, contradicting the comment directly above it ("This applies regardless of--no-relaunch... must always be stopped first"). Every invocation left another live process behind, reaped only when the lease was released.Ablation
TestRepeatedOpenLeavesOneLogStreamAliveruns fourmav open --no-relaunchagainst a hermetic fakexcrun(the existingwriteFakeXcrunshim, wherelog streamexecs a realsleep), and counts the recorded probe-logs PIDs that answerkill -0.Fix reverted (
git stashofcli.goonly, test unchanged):Fix re-applied:
Plain
mav openwas measured the same way and stays at 1 on both sides — no regression there.The change
The
hasBoundRunguard is gone. On a fresh run nothing is recorded yet, so the call is a no-op there.The test owns its own simulator UDID rather than the shared
"SIM": the sim lock is a global file keyed by UDID, so sharing it makes a secondopenfail withsim_lockedfor reasons that have nothing to do with log streams.go build ./...andgo test ./... -count=1green.https://claude.ai/code/session_018Qmew9oEQ6frPLSrE8XUm5