mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #633] The pinned expert arena is allocated without a host-RAM check: a container limit or a low MemAvailable ends in the OOM killer mid-load, not a message (the file tier already has the probe) #298
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#298
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Avicennasis on GitHub (Oct 3, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/633
On
mainat99f3dbd(0.1.38). Host RAM, not VRAM: #486 (the weight arena / a hard-frozen host at 262K) and #620 (the native head upload's out-of-memory at startup) are the VRAM side of the same shape; this is the pinned expert arena against the RAM the process can actually get.What is there
available_memory_bytes()(src/core/expert_source.cpp:220-283, in the file's anonymous namespace) readsMemAvailablefrom/proc/meminfo, then walks the cgroup-v2 ancestors of the0::/line in/proc/self/cgroupunder/sys/fs/cgroup, taking the minimum ofMemAvailableand eachmemory.maxminus whatmemory.current/memory.statsay is held; on Windows it isullAvailPhys.FileExpertSource::pin_cache_complementuses it for--resident-budget-gib(:1263): a budget over the room is clamped toavailable - headroom - 256 MiBand says so with its numbers (:1270-1285, #403), and a complement that still does not fit is refused with the numbers named (:1326-1331):That is the right shape. It only runs on the file tier (
--mmap-experts).What is not
ArenaExpertSource::open(:2545) - the pinned arena, the default tier - checks the pack's size against the layout before allocating (:2560-2581, "SIZE CHECK BEFORE THE ALLOCATION, not after") and then goes straight tonew PinnedArena(want + blob, ...)(:2597). Nothing reads the host's available memory on that path:generate.cpp:2783callsopenafter the pin-cap decision, and the onlyMemAvailableread ingenerate.cpp(:781) feeds the stall report (:811-813), not a decision. On Linux the arena is an anonymousMAP_PRIVATEmmap (src/core/pinned.cu:227), so the mapping of 30-77 GB succeeds whatever the host has, the pages are committed asload_experts_rangeswrites them, and a host (or a container with amemory.maxunder the arena) finds out from the OOM killer partway through the load, or from swap - the hard freeze #486 describes, from the other side. The message, when there is one, is the kernel's. A 128 GB host whoseMemAvailableis 20 GB because another engine is still exiting gets the same ending.Two smaller things on the probe itself:
0::/line; on a v1-only host (older Docker hosts, RHEL 7/8 defaults, some Kubernetes nodes still) there is none,resolved_v2stays false and the function returns false, so the file tier refuses the budget with "cannot determine available RAM" rather than readingMemAvailableandmemory/memory.limit_in_bytes. The arena, once it has the probe, should not inherit that.src/platform/memory_test.cpp(35 lines) only exerciseslock_residenton 256 MiB; the cgroup walk has no test, so a fake root withmemory.max=max, a number, a missing file, a malformed value, and a v1 tree cannot be checked without a container.What I would do
Move
available_memory_bytestosrc/platform/memory.{hpp,cpp}besidelock_resident(same file-local logic, a root path parameter so a test can point it at a fake tree,/sys/fs/cgroupby default), add the v1 fallback (thememorycontroller's path from/proc/self/cgroup,memory.limit_in_bytesandmemory.usage_in_bytes; no cgroup line at all meansMemAvailablealone, not "cannot determine"), and call it inArenaExpertSource::openright after the size check, before thePinnedArena- the arena knowswant + blobthere. Refuse with the three numbers the way the file tier and the #486 VRAM message do, plus what makes room:STRATA_RESIDENT_HEADROOM_GIB(generate.cpp:1313) is the natural headroom to reuse.memory_test.cppgets the fake-root cases: v2max/ numeric / missing / malformed (refuse), v1 limit, no cgroup line. The file tier keeps calling the same function, so its behaviour on v2 is unchanged and on v1 it stops refusing.Size: M - the move and the call are ~40 lines, the v1 branch ~30, the tests the rest; nothing in the cache policy, the adaptive tier or the conversation cache. I can send it as a PR if you want it; filing first because it adds a refusal to the default start path and you may prefer a warning there, or a different headroom.
@Niko1221 commented on GitHub (Oct 4, 2026):
Thanks for the careful read. In 0.1.39 the expert arena checks the host RAM right after its size check and before the allocation. A hard cgroup limit (memory.max, or v1's memory.limit_in_bytes) below the arena stops the start with both numbers, because the OOM killer would end it anyway. Less available RAM than the arena is a warning with the numbers and the
--mmap-experts --resident-budget-gibtip, and the load goes on: the OS can often make room, and setup recommends rather than refuses. The probe takes its files as parameters and is tested on fake trees: v2 limit/max/malformed/missing, v1 limit/unlimited/not mounted, and no cgroup line. It now reads cgroup v1, and no cgroup line at all means MemAvailable alone, so a--resident-budget-gibon a v1 host is no longer refused.