Repository navigation
fix(bin): retry ShellCheck roots that hit the memory ceiling without --external-sources - #14
Merged
Merged
Conversation
…--external-sources (kunchenguid#6443) * fix(lint): retry memory-bound roots without external sources * no-mistakes(review): Make fallback tests portable and correct source-following telemetry * no-mistakes(review): Remove committed parity fixtures and use disposable test roots * no-mistakes(document): Document ShellCheck memory fallback and telemetry * no-mistakes(review): Cover bounded and unbounded fallback RSS behavior * no-mistakes(document): Correct stale lint fallback documentation * no-mistakes(document): Correct stale lint test documentation * no-mistakes(ci): The memory fallback (the retry without --external-sources) now gets only the time left in its root's original deadline, so it can no longer outlast the CI job. Invariant: one root's first attempt plus its fallback must fit inside a single FM_LINT_ROOT_SECONDS deadline, plus the cleanup grace. Only one site started a new deadline: the fallback call in fm_lint_run_root. The deadline is the only budget involved, because the memory limit already applies to each process separately. Changes in bin/fm-lint.sh: - fm_lint_exec_root now takes a <seconds> argument instead of always reading FM_LINT_INTERNAL_ROOT_SECS. - The first attempt passes the full deadline. - The fallback passes floor((start + deadline - now) / 1000) seconds. - When bounds are enforced and less than 1 second is left, no retry starts. fm_exec_timed rejects 0 seconds, so the retry cannot run with no time. The root keeps reason=memory, and the shard output says "no time left in its Ns deadline to retry without it". - Unbounded local runs have no deadline and behave as before. - The header comment now describes the shared deadline. Changes in tests/fm-lint.test.sh: a new test, test_memory_fallback_spends_only_the_remaining_root_deadline, runs only on hosts that can enforce bounds. It uses a 6 s deadline and 1 s grace. - Case 1: the first attempt runs 3 s and then fails with memory status 251. The test asserts one fallback ran, reported reason=timeout, and the root's recorded duration is under 7000 ms. - Case 2: the first attempt runs 5.2 s. The test asserts no fallback starts, the skip is explained, and the sidecar records memory with source-following 1. Verification: - Full `nice -n 10 bash tests/fm-lint.test.sh` passed, including the new test, in about 5 minutes. - Case 1 run against the HEAD script: the root took 9168 ms, so the under-7000 ms check fails before the fix. - `bin/fm-lint.sh bin/fm-lint.sh tests/fm-lint.test.sh` reported no findings. - The CI workflow is unchanged, so the Test step still runs only tests/fm-lint.test.sh with nice -n 10 and the 12 GiB ShellCheck limit
sctru
force-pushed
the
fm/fm-lint-shellcheck-oom
branch
from
October 4, 2026 06:21
2ca0f57 to
56f1df6
Compare
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.
Problem
CI "Lint 1" fails with
shellcheck: out of memory(exit 251) on bin/fm-teardown.sh, on main (runs 37162304110, 37165495594) and on PR #13 (run 37166350107).The root peaks at about 8.39 GB resident in CI with
--external-sources(8.38 GB reproduced locally, 61 s), right at the runner's memory limit, which is why one PR #12 rerun passed.Cause
This fork's main predates upstream's memory fallback (kunchenguid/firstmate kunchenguid#6443, d719ef3).
Without it, a root that hits the memory ceiling fails lint outright.
Fix
Cherry-pick d719ef3 unchanged (bin/fm-lint.sh, tests/fm-lint.test.sh, docs/fm-test-portable-shards.md).
A root that exhausts memory with
--external-sourcesis retried once without it under the same deadline, excluding only the cross-file codes (SC1091, SC2034, SC2153, SC2329).fm-teardown.sh stays linted, and other findings still fail.
Measurements for bin/fm-teardown.sh
--external-sources, rc 251 in CI at 8,391,476 KiB peak RSS; main without the fallback.FM_LINT_REQUIRE_BOUNDS=1 FM_LINT_ROOT_MEMORY_KIB=8388608): reasonmemory-fallback, rc 0, final no-sources attempt about 0.79 GB RSS in 3.7 s.Note: the source-following analysis of fm-teardown.sh is itself near the limit and growing, so a later reduction of its sourced graph may still be worthwhile; that is out of scope here.