No process-level heap cap: OOM aborts (rc 134); sandbox max_bytes misses general growth
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- c
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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.eigspeaks at 21 MB RSS, yet it was killed under a 1.5 GB-vcap. 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:
- It is reachable only from inside a program, around an assembled chunk. It cannot cover a whole run.
- It charges only the size-controlled allocators (
zeros/fill/buffer/range/concat) and the zlib codecs. General growth like theappendloop 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'slua_newstate, wasm max memory pages. - Harness-level RSS monitors: libFuzzer
-rss_limit_mbreports OOM as its own outcome. - AFL documents that its RLIMIT_AS limit (
-m) must benoneunder ASan, which is the same failure as above.
Decision needed
- The knob: an env flag (
EIGS_MAX_HEAP=<bytes>, parsed like the othereigs_env_flagknobs), a CLI flag, an embed API field, or all three. - What gets charged: every
eigs_alloc(a chokepoint charge, which catches theappendloop), or live bytes net of frees (which needs the counter decremented on free). - What happens at the cap: an
rt_errorof a new kind (catchable bytry, a clean exit code distinct from 134), and what the trace tape records. - Whether
sandbox_run'smax_bytesbecomes 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_runwithmax_bytesset is stopped by the budget. It returns{ok: 0}, and the host does not abort. -
tests/handles_full.eigsruns 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.
- 主要语言
- C
- 星标
- 3
- 派生
- 7
- 平均合并
- 4 小时 7 分钟
- 30 天内合并 PR
- 112
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
InauguralSystems/EigenScript 的其他 Issue
-
area:embed kind:silent-wrong
难度 2/5 1-3 小时 新手友好度 78/100
InauguralSystems/EigenScript#1387 ·
维护者通常 1 天内回复
-
area:stdlib kind:silent-wrong
难度 2/5 1-3 小时 新手友好度 86/100
InauguralSystems/EigenScript#1378 ·
维护者通常 1 天内回复
-
area:gates kind:gate-defect
难度 2/5 1-3 小时 新手友好度 78/100
InauguralSystems/EigenScript#1374 ·
维护者通常 1 天内回复
-
Error carets pad multi-byte UTF-8 byte-for-byte, so the ^ lands right of the token on a terminal未关闭area:lint-tooling kind:silent-wrong
难度 2/5 1-3 小时 新手友好度 84/100
InauguralSystems/EigenScript#1373 ·
维护者通常 1 天内回复
-
area:gates kind:docs-drift
难度 1/5 1 小时以内 新手友好度 88/100
InauguralSystems/EigenScript#1372 ·
维护者通常 1 天内回复
查看 InauguralSystems/EigenScript 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
-
难度 1/5 1 小时以内 新手友好度 92/100
-
[Issue]: Headers - vx_ext_amd.h does not compile as C (enum types used without the enum keyword)未关闭
难度 1/5 1 小时以内 新手友好度 92/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
-
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复