Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

No process-level heap cap: OOM aborts (rc 134); sandbox max_bytes misses general growth

Aperta
#1,319 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
c

Direzione di ricerca

Start by reading docs/PRINCIPLES.md and the existing sandbox_run max_bytes behavior, then trace the eigs_alloc chokepoint and run the supplied OOM reproduction. Compare the proposed cap, error, charging, and trace behavior with the sandbox requirements. Done includes a catchable named error, non-134 exit, stopped sandbox growth, a clean handles_full.eigs run, overhead measurements, and synchronized updates to docs/SPEC.md, docs/BUILTINS.md, docs/EMBEDDING.md, and docs/llms.txt.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area:embed area:memory kind:decision

Gap

There is no process-level heap cap. An embedder, a CI harness or an agent running generated .eigs cannot bound a whole run's memory. The only tools are OS limits, and both are poor fits:

  • ulimit -v (RLIMIT_AS) counts reserved address space, not use. Each thread reserves an 8 MiB stack and a 64 MiB malloc arena up front. Measured in #1318: tests/handles_full.eigs peaks at 21 MB RSS, yet it was killed under a 1.5 GB -v cap. That produced false one-sided rows in a differential harness.
  • cgroups (systemd-run -p MemoryMax=, container limits) work, but they end in a SIGKILL from outside. The program never sees an error, and the harness cannot tell an OOM from a crash without extra machinery.

When memory does run out, the runtime aborts. Repro on main 94c4c5b:

xs is []
s is "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
i is 0
loop while i < 100000000:
    xs is append of [xs, s + (str of i)]
    i is i + 1
print of "done"
$ ( ulimit -v 300000; src/eigenscript oom.eigs; echo rc=$? )
eigenscript: out of memory (requested 64 bytes)
Aborted (core dumped)
rc=134

sandbox_run's max_bytes is the one budget that exists (#739), and it has two limits:

  1. It is reachable only from inside a program, around an assembled chunk. It cannot cover a whole run.
  2. It charges only the size-controlled allocators (zeros/fill/buffer/range/concat) and the zlib codecs. General growth like the append loop above is not charged, so even a sandboxed run can exhaust the host.

Prior art (for the decision)

  • Runtime-level heap caps that raise a named error: JVM -Xmx (OutOfMemoryError), V8 --max-old-space-size, the allocator limit in Lua's lua_newstate, wasm max memory pages.
  • Harness-level RSS monitors: libFuzzer -rss_limit_mb reports OOM as its own outcome.
  • AFL documents that its RLIMIT_AS limit (-m) must be none under ASan, which is the same failure as above.

Decision needed

  • The knob: an env flag (EIGS_MAX_HEAP=<bytes>, parsed like the other eigs_env_flag knobs), a CLI flag, an embed API field, or all three.
  • What gets charged: every eigs_alloc (a chokepoint charge, which catches the append loop), or live bytes net of frees (which needs the counter decremented on free).
  • What happens at the cap: an rt_error of a new kind (catchable by try, a clean exit code distinct from 134), and what the trace tape records.
  • Whether sandbox_run's max_bytes becomes the same mechanism scoped to the run, which would close its second limitation above.

Done when

  • The decision above is recorded in this issue, citing a principle from docs/PRINCIPLES.md.
  • Running the repro above with the cap set to 64 MiB ends in a named, documented error with a non-134 exit code, and the program can catch it with try.
  • The same program under sandbox_run with max_bytes set is stopped by the budget. It returns {ok: 0}, and the host does not abort.
  • tests/handles_full.eigs runs clean under a cap well above its measured peak (for example 64 MiB), proving thread reservations are not charged.
  • Measured overhead with the cap unset is recorded, taken from the perf-attribution paired samples or the CodSpeed instruction count on the DMG target.
  • docs/SPEC.md, docs/BUILTINS.md (sandbox_run), docs/EMBEDDING.md and docs/llms.txt describe the knob, all in the same PR.
Lingua principale
C
Stelle
3
Fork
7
Merge medio
3h 58m
PR unite (30g)
105

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di InauguralSystems/EigenScript

Tutte le issue di InauguralSystems/EigenScript

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.