mirror of
https://github.com/garrytan/gbrain.git
synced 2026-07-29 19:01:39 +00:00
fix(sync): raise maxBuffer to 100 MiB to prevent silent ENOBUFS crash (#982)
Node's default maxBuffer for execFileSync is 1 MiB. On repos with 60-100K files, `git diff --name-status -M` output easily exceeds this, causing the sync process to die silently with no error in the log. Observed at /data/brain (99K files, 62K in git ls-files): sync consistently died during the rename-detection phase at ~15% through `buildSyncManifest()`. No stack trace, no error event — just a dead process. The fix survived 5+ full syncs on the same corpus. 100 MiB is generous but bounded. A 100K-file diff with long paths tops out around 10-20 MiB in practice. Co-authored-by: garrytan-agents <garrytan-agents@users.noreply.github.com>
This commit is contained in:
co-authored by
garrytan-agents
parent
1a6b543cc5
commit
cb8d6d8724
@@ -211,10 +211,21 @@ export function buildGitInvocation(repoPath: string, args: string[], configs: st
|
||||
return [...cfg, '-C', repoPath, ...args];
|
||||
}
|
||||
|
||||
/**
|
||||
* Shell out to git with a generous maxBuffer.
|
||||
*
|
||||
* Node's default maxBuffer is 1 MiB. `git diff --name-status -M` on a
|
||||
* 60–100K file repo easily exceeds that, causing an ENOBUFS crash that
|
||||
* kills the sync process with no error message in the log.
|
||||
*
|
||||
* 100 MiB is generous but still bounded — a 100K-file diff with long
|
||||
* paths tops out around 10–20 MiB in practice.
|
||||
*/
|
||||
function git(repoPath: string, args: string[], configs: string[] = []): string {
|
||||
return execFileSync('git', buildGitInvocation(repoPath, args, configs), {
|
||||
encoding: 'utf-8',
|
||||
timeout: 30000,
|
||||
maxBuffer: 100 * 1024 * 1024,
|
||||
}).trim();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user