Repository navigation
fix(broker): free a lease whose attached process is gone (#104) - #108
Merged
Merged
Conversation
The run's disconnect was the only signal that a lease ended. When the whole run tree is killed and the disconnect never reaches the daemon, the lease stayed granted with no process for as long as anyone looked. Each tick now checks the attached process by PID and start time. Seen gone on two ticks in a row, with no container named and nothing of the run still counted on the card or alive as a descendant, the lease is released the way a disconnect releases it, with a lease.orphaned event first. A reused PID counts as gone. Nothing is signalled. Descendant sets are now pruned while any has entries, so a dead run's children clear from its lease; with no attached run and no entries the process table is still not read. Fixes #104.
# Conflicts: # CHANGELOG.md
This was referenced Oct 21, 2026
Merged
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.
Fixes #104, reported by @azrael-229.
The run's socket disconnect was the only signal that a lease ended. When the run's whole tree is killed (
taskkill /F /T, a crash) and that disconnect never reaches the daemon, the lease stayed HOT withPIDS []until aberth stop.lease.orphaned, thenlease.releasedandlease.freedonce the card shows it gone. With a 2 s poll that is about 6 s instead of forever.lease.orphanedshows as a warning inberth eventsand as ORPHANED in the harbor.Tests (
internal/broker/reap_test.go): dead pid released after two ticks and freed; reused PID; live pid with a lookup hiccup; container lease; a child outliving the wrapper released only after it exits.Proof: build, gofmt, vet,
go test ./...,-race -count=3on the reaper tests, GOOS=windows build and vet, golangci-lint (0 issues).