fix(standalone): unbounded child log pumps + never-empty version#2167
Open
jlaneve wants to merge 2 commits into
Open
fix(standalone): unbounded child log pumps + never-empty version#2167jlaneve wants to merge 2 commits into
jlaneve wants to merge 2 commits into
Conversation
…version Two hardening fixes found while debugging a wedged standalone scheduler: 1. startForeground pumped the airflow child's stdout/stderr through bufio.Scanner, which silently stops at the first line longer than its 64KB token limit. If a pump goroutine exits while the child lives, the child's 16KB stdout pipe fills and its next write() blocks forever, freezing it mid-loop (the scheduler logs task lists that can exceed 64KB on one line). Use io.Copy, which never stops reading until EOF. Background mode was never affected (stdout goes straight to a file). Note: the wedge that prompted this investigation turned out to be machine-wide kernel pipe-buffer exhaustion (~14k leaked pipe fds held by stale terminal sessions starved XNU's pipe KVA pool, making any new pipe's first write block system-wide), not this code path. The Scanner limit is a real latent wedge of the same shape, fixed here. 2. astro version printed an empty string when the binary was built without the Makefile's -ldflags (e.g. plain go build / go install). Fall back to Go build info: module version, then vcs revision, then plain SNAPSHOT, so the version is never empty. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Coverage Report for CI Build 0Coverage remained the same at 44.776%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
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
Two hardening fixes found while chasing a local scheduler wedge (whose actual root cause turned out to be machine-level kernel pipe-pool exhaustion, not the CLI; details in the commit message):
airflow/standalone.go: the foreground-mode child stdout/stderr pumps usedbufio.Scanner, whose default 64KB token limit makesScan()return false silently on a single long log line. The pump goroutine then exits, the pipe fills, and the child process blocks forever inwrite(). Airflow's scheduler routinely emits very long single-line records (task lists), so this is a real latent wedge. Replaced withio.Copy, which never stops reading until EOFversion/version.go: builds without the Makefile's-ldflags(e.g. plaingo install) printed an empty string forastro version. Added aninit()fallback chain: module version, thenvcs.revisionshort SHA, thenSNAPSHOTValidation
go vetclean./versionand standalone tests pass; the one pre-existing./airflowfailure (TestRegistryLogin, macOS keychain) fails identically on untouched main🤖 Generated with Claude Code