mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-11-27 22:38:50 +00:00
|
Some checks are pending
Gitleaks / gitleaks (push) Waiting to run
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
Publish / Classify release event (push) Waiting to run
Publish / RC guard (marker + release-PR skip) (push) Blocked by required conditions
Publish / ci (push) Blocked by required conditions
Publish / Publish to npm (push) Blocked by required conditions
Publish / Build & Push RC Docker images (push) Blocked by required conditions
Scorecard / Scorecard analysis (push) Waiting to run
Trivy Image Scan / Trivy (gitnexus-cli) (push) Waiting to run
Trivy Image Scan / Trivy (gitnexus-web) (push) Waiting to run
* fix(analyze): enforce parse-worker heap caps under an inherited heap flag
V8 reads --max-old-space-size and --max-semi-space-size when it creates
an isolate, and the process-wide values override a Worker's
resourceLimits. Under the analyze respawn's flags every parser worker
therefore ran with the main heap limit instead of its own cap, and with
a 384 MiB young generation.
The default parser-worker factory now spawns through a process-wide
lease that clears both flags while workers start and restores them when
the last starting worker reports online, posts its first message, or
exits. A synchronous restore right after new Worker() races the isolate
creation on the worker thread, so the lease waits for those events.
Initial spawns, startup retries and replacements all use this factory.
The plan cleared only the old-space flag; measuring showed the
semi-space flag also overrides the worker's young generation (a 512 MiB
worker reported 896 MiB instead of 560 MiB), so the lease clears both.
Admission is unchanged here and still reserves at least the main heap
per worker, which over-reserves safely; the next commit charges each
worker its own cap.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(analyze): charge each parse worker its own heap cap in resource admission
Admission assumed every parser worker inherits the main heap limit, so it
charged each worker max(mainHeap, workerHeap) + 128 MiB, divided the main
heap by (requiredWorkers + 1), and also capped it at 35% of the total. In
a 10 GiB / 4-CPU container that admitted a 2639 MiB main heap, and on a
4-CPU host it admitted one parse worker at every size from 4 to 32 GiB.
The parser pool now enforces each worker's cap (previous commit), so a
worker is charged its own heap plus the 128 MiB native allowance. The
main heap holds the analysis peak and is sized first: it takes what the
pools, headroom and required workers leave, capped at 16384 MiB and at
an unpinned runtime limit. Automatic workers fill the remainder up to
the CPU count. The rejection minimum uses the same inequality.
4 CPUs, 200 MiB supervisor, no model (main / workers / worker heap):
4 GiB: 957 / 1 / 958 -> 1403 / 1 / 512
10 GiB: 2639 / 1 / 2639 -> 4206 / 1 / 1072
16 GiB: 4300 / 1 / 4300 -> 6850 / 3 / 512
A sweep over RAM, CPUs, explicit totals, heaps, workers, models and
supervisor sizes finds no newly rejected request, no smaller main heap
and no reservation above the total. isConstrainedPdgBuild is unchanged;
the measured 6 GiB / one-worker PDG envelope stays constrained.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(analyze): key the constrained PDG write guard on requested workers
isConstrainedPdgBuild serializes LadybugDB COPY/FTS and limits malloc
arenas for the measured 6 GiB, single-worker PDG configuration. It read
the admitted parser worker count. Since admission now charges workers
their own cap, an explicit small budget such as
--pdg --resource-budget 6144 --memory-budget 2048 on 4 CPUs fits three
workers and silently dropped the guard, although the graph write it
protects runs after the parser workers exit and its memory is the same.
The budget now carries the worker count the operator requested (the
explicit --workers value, or 1 when automatic) and the guard reads it.
Predicate sweep over 544,320 requests (158,826 admitted by every
version), pdg on, against upstream/main: 0 configurations lose the
guard; 1,920 gain it (explicit budgets where upstream/main fitted more
than one automatic worker), which only makes their COPY serial. The 416
configurations the previous commit had turned off are all constrained
again. Explicit --workers N > 1 stays unconstrained.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(analyze): describe enforced parser-worker heap caps
Parser workers used to run with the main heap limit by accident; they now
run at their admitted cap, 512 MiB on common hosts. Say so in MIGRATION.md
and next to --max-file-size in the README: files above roughly 2 MB or
large explicit sub-batches can exceed the cap, the file is quarantined,
and GITNEXUS_WORKER_HEAP_MB raises it.
Also fix two stale sentences: the RUNBOOK still said each worker reserves
at least the --memory-budget allocation, and the README named one heap
flag where the pool clears both --max-old-space-size and
--max-semi-space-size.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(analyze): cover a parser worker dying at its enforced heap cap
With caps now enforced, an oversized job ending in
ERR_WORKER_OUT_OF_MEMORY is an expected outcome, and no test drove a
worker past its cap. The new case runs a pool of one 512 MiB worker
under --max-old-space-size=3000 and has it allocate up to 1 GiB on one
file. It asserts that dispatch resolves, the log names the cap and
GITNEXUS_WORKER_HEAP_MB, the file is quarantined and counted in stats,
the slot respawns, and the files around it are still parsed.
On upstream/main the worker inherits the main limit, so the same file
parses, nothing is quarantined and the case fails on the missing hint.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(analyze): derive the respawned main heap from the mocked host
Three heap-respawn tests pinned the main heap the old admission rule
gave the mocked 16 GiB host (4300 MiB, respawned as
--max-old-space-size=3916). Admission now sizes the main heap first:
75% of RAM (12288 MiB) minus headroom, supervisor, graph pool, vector
pool and embedding queues, which gives 6858 MiB and an old space of
6858 - 3 x 128 = 6474 MiB.
The tests now compute that value from the same host constants instead
of a literal, and pin the supervisor's RSS below its 192 MiB floor: the
main heap now depends on the measured supervisor reservation, which
otherwise varies with the test process.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* perf(analyze): start community workers through the heap lease
Node shares one built-in code cache between a process's isolates and
accepts an entry only under the V8 flag hash it was compiled with. The
parser-worker heap lease clears the inherited heap flags while a worker
starts, so that worker recompiles the built-ins its startup needs and
stores them under the cleared hash. The Leiden worker, created after
the flags were restored, then rejected those entries and recompiled
again: about 14 ms on the analyze-resume incremental scenario, where
the CI benchmark measured a ~0.7% slowdown.
The graphology and icebug workers now start through the same lease, so
their startup reuses the parser worker's entries and their later loads
the main isolate's. They pass inheritedWorkerResourceLimits(), the old
space and three semi-spaces the inherited flags give, so their heap is
unchanged.
CPU profiles of three incremental pairs (16 GiB / 4 CPUs simulated),
built-in compile time added per worker vs the base revision: Leiden
+13.8 ms before, +0.1 ms after; the parser worker's startup recompile
(+11 ms) remains. Clearing the flags once without restoring was also
measured and moved the cost into the parser worker instead (+24.7 ms).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Keep allocator defaults for multi-worker PDG parsing (#4045)
Apply the two-arena default only for a single admitted parser worker. Keep each worker's young generation inside its reservation, reuse its startup options, and share quoted numeric heap-flag parsing with CLI admission.
Cover allocator selection, real worker caps and reentrant startup events. Document community and loader heaps outside admission.
Validation: six incremental-index tests failed during a full run stopped early. All six passed in isolated reruns on the original and updated revisions.
* perf(analyze): lease community workers only after a parser worker did
Starting a worker under the cleared heap flags pays a one-time
recompile of the built-ins its startup needs, because Node's shared
built-in code cache is keyed by the V8 flag hash. Routing the community
workers through the lease saves that cost only when a parser worker has
already started under the cleared flags. With a warm parse cache, as in
`analyze --force` on an unchanged repository, no parser worker starts,
so the leased Leiden worker became the first to recompile: 6-file
repository, 20 runs each, Leiden spawn to result median 47.5 ms on the
base revision, 71.0 ms with the lease, 49.0 ms with this change.
spawnWithInheritedHeap() now takes the lease, with
inheritedWorkerResourceLimits(), only after a parser worker has used
the cleared flags in this process, and otherwise spawns plainly under
the inherited flags as before. The parser-worker path is unchanged.
Also restore the caveat that a Worker created in the analysis process
without these helpers while a lease is open gets V8's default heap.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(analyze): keep two allocator arenas when several PDG parser workers fit
The constrained PDG guard starts the first analyze child, which runs the
parser pool and then the graph writer, with MALLOC_ARENA_MAX=2 on Linux
with glibc.
|
||
|---|---|---|
| .. | ||
| guard-taint-overhead-report.md | ||
| guard-taint-overhead-results.json | ||
| main-pipeline-performance-report.md | ||
| pdg-spill-time-memory-report.md | ||