No process-level heap cap: OOM aborts (rc 134); sandbox max_bytes misses general growth
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- c
- Lĩnh vực
- compilers, documentation
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- C
- Star
- 3
- Fork
- 7
- Merge trung bình
- 8 giờ 41 phút
- Pull request đã merge (30 ngày)
- 254
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của InauguralSystems/EigenScript
-
eigenscript.h declares 8 observer functions that no longer existCó thể đã có người làm @facelessdevhack đã nhận 3 ngày trước. Đang mởarea:observer enhancement found-by:cold-read good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
InauguralSystems/EigenScript#1781 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Amalgamation compiles with warnings at -O0 (-Wreturn-type) and -O1 (-Wmaybe-uninitialized)Có thể đã có người làm @facelessdevhack đã nhận 3 ngày trước. Đang mởarea:embed bug found-by:code-review
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
InauguralSystems/EigenScript#1775 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
UB: (int) cast of a user double outside int range in dispatch / vm_index_is_int / flat_index_atĐang mởarea:runtime-vm
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
InauguralSystems/EigenScript#1748 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
scan_int_tokens line/col fields are untestedCó thể đã có người làm @facelessdevhack đã nhận 3 ngày trước. Đang mởarea:stdlib found-by:critic kind:gate-defect
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
InauguralSystems/EigenScript#1693 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:gfx bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
InauguralSystems/EigenScript#1684 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của InauguralSystems/EigenScript
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
OpenPrinting/cups#1772 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
snowballstem/snowball#311 ·
-
tech-debt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100