Skip to content

fix(git): git: variables resolve while the event loop is busy - #88

Merged
DavidWells merged 1 commit into
masterfrom
fix/git-exec-busy-loop
Oct 25, 2026
Merged

DavidWells merged 1 commit into
masterfrom
fix/git-exec-busy-loop

Conversation

@DavidWells

Copy link
Copy Markdown
Owner

Problem

${git:url} (and every other git: variable) comes back undefined → Missing Value ${git:url} when a large config renders on a loaded machine, even though git answers in ~6 ms.

The resolver runs git through execFile with a 1000 ms timeout. That timer starts when git is spawned and also counts time the event loop spends resolving other variables before it reads git's exit. Once that busy time passes 1 s, the timers phase fires the timeout first and _safeGit swallows the error as undefined.

Repro (saaslayer monorepo, user-service stack.yml, ~237 variables, load ~240 on 12 cores): stack-render tests and osls package fail on ${git:url} and pass when run alone.

Same resolver, loop kept busy after spawn:

busy after spawn result
0–900 ms https://github.com/DavidWells/saaslayer
1100 ms+ undefined

Fix

One GIT_TIMEOUT_MS = 30000 used by all three git exec sites in src/resolvers/valueFromGit.js. The timeout's job is only to stop a hung git, so it can be generous.

Tests

  • New tests/gitVariables/gitBusyLoop.test.js: resolves ${git:url} and ${git:commit} while the loop is busy 1.5 s, run from the check phase so the timers phase comes next (as between resolutions of a big config). 0/2 before the fix, 2/2 after (3 runs each).
  • Full npm test in packages/configorama: 2712/2712 passed (5 pre-existing skips), exit 0.

The 1 s execFile timeout also counted time the loop spent on other work
before reading git's exit, so a large config on a loaded machine got
undefined for ${git:url} though git answered in ms. Bound each git read
at 30 s instead.
@DavidWells
DavidWells merged commit cd38d26 into master Oct 25, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant