Reap the log aggregator's tail processes - #350
Merged
Merged
Conversation
Sayan-
marked this pull request as ready for review
August 24, 2026 20:54
tailFile started tail -F and never waited on it. The wrapper runs as pid 1 in both the container and the unikernel, so every exited tail stayed a zombie for the life of the instance. A scan that ends on a read error rather than EOF leaves tail alive, so kill it before waiting instead of parking the goroutine forever.
Sayan-
force-pushed
the
hypeship/wrapper-tail-wait
branch
from
August 24, 2026 21:00
47c35bf to
cf73a4d
Compare
Sayan-
marked this pull request as draft
August 24, 2026 21:01
Sayan-
marked this pull request as ready for review
August 24, 2026 21:10
Sayan-
marked this pull request as draft
August 24, 2026 21:24
Sayan-
marked this pull request as ready for review
August 24, 2026 21:27
masnwilliams
approved these changes
Aug 25, 2026
masnwilliams
left a comment
Contributor
There was a problem hiding this comment.
reviewed — looks good. the cleanup follows os/exec's pipe lifecycle correctly, handles scanner failure without blocking, and ensures the tail process is always reaped.
sjmiller609
approved these changes
Aug 25, 2026
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.
Summary
tailFilestartstail -n +1 -F <path>and reads its stdout, but never callsWait. When that tail exits, nothing collects its status, so it stays a zombie.The wrapper is pid 1 in both the container (
ENTRYPOINT) and the unikernel (Kraftfilecmd), so there is no other init to clean up after it. On a long-lived instance whose services restart repeatedly, these accumulate for the life of the instance and each one holds a pid slot.A clean scan ends exactly when tail closes its stdout, which is when it has exited, so that is where the wait belongs. A scan that ends on a read error instead is a different case:
bufio.Scanneralso stops onErrTooLong, and there tail is still alive, so waiting would park the goroutine forever. Kill it first in that path.Testing
go build,go vet,gofmtandgo test -racepass onserver/cmd/wrapper.No test added here.
tail -Fdoes not exit on its own andtailFilekeeps no handle to the process, so there is no seam to drive it from a test without reshaping the function. The reaper PR stacked on this one carries tests that cover the same defect class directly.Note
Low Risk
Localized change to log tailing cleanup in the wrapper; no auth, data, or API surface impact.
Overview
tailFilein the wrapper supervisord log aggregator previously startedtail -Fand read lines but neverWait()on the child. Because the wrapper runs as pid 1 in container and unikernel, exited tails became zombies that could pile up when services restart.After the scan loop, the change always **
Wait()**s to reap the process. Ifscanner.Err()is set (e.g. a line exceeds the 1MB scanner limit whiletailis still running), it **Kill()**stailfirst soWait()does not block forever.Reviewed by Cursor Bugbot for commit 20a0f55. Bugbot is set up for automated code reviews on this repo. Configure here.