Stream git log instead of buffering to fix ENOBUFS on large ranges - #122
Merged
Conversation
RomainCscn
force-pushed
the
romain/lin-79789-stream-git-log
branch
from
July 27, 2026 09:29
98ac6e9 to
9b59ab1
Compare
RomainCscn
force-pushed
the
romain/lin-79789-stream-git-log
branch
from
July 27, 2026 09:35
9b59ab1 to
8906dbf
Compare
mwolting
approved these changes
Jul 27, 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.
To scan a release range,
runLograngit logthroughexecSync, which collects the entire output in one in-memory buffer capped bymaxBuffer— 1 MiB by Node default, 256 MiB since #103. When a range's output crosses the cap, Node kills git and the sync dies withspawnSync /bin/sh ENOBUFS. Crossing it depends on commit count × message size, so the same pipeline passes one day and crashes the next.runLognow spawns git and parses the output as a stream: each commit record is parsed as soon as its%x1eseparator arrives, and the raw bytes are discarded. No buffer ever holds the whole output, so there is no cap left to hit — memory scales with the parsed commits, not with whatever git prints.Also folded in:
/bin/shcommand string, so--include-pathspatterns (CLI- or server-provided) are no longer interpolated into a shell command where metacharacters could break or inject into it.getCurrentGitInforead the HEAD message with the default 1 MiB cap inside one try/catch covering all three fields, so one oversized HEAD message failed the whole sync as "Could not get current commit". Each field now fails independently and the message read is bounded at 10 MiB.Regression test: a
git fast-importfixture drives a 270×1 MiB range past the old 256 MiB cap — it crashed before this change.Fixes LIN-79789