fix(zakura): harden auto block-sync memory ceiling#226
Draft
evan-forbes wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Block-sync's in-flight block-body byte ceiling defaulted to a flat value and could be bypassed by runtime paths that accepted
MemoryLimit::Autowithout resolving it against real system memory. On cgroup-limited hosts, especially containers, that can overestimate available memory and risk OOM/SIGKILL during startup or sync.This PR implements the auto memory provisioning plan for Zakura block sync and hardens the follow-up review findings around cgroup discovery, resolver invariants, and the resolved-config boundary.
Solution
MemoryLimit::{Auto, Bytes}config support and resolve it once at startup through an injectableMemoryProbe.zebradthat resolves the process cgroup path from/proc/self/cgroupand/proc/self/mountinfo, walks ancestors, and clamps host memory by effective cgroup limits/headroom.MIN_CEILING,MAX_CEILING, and the factor-aware effective bound.ZakuraBlockSyncConfigfrom runtimeResolvedZakuraBlockSyncConfigsoMemoryLimit::Autodoes not reach the block-sync runtime/ByteBudgetpath.Tests
Passed:
Attempted but blocked before test execution:
cargo test -p zebrad memory_probe --lockedThis failed while compiling
librocksdb-sys v0.16.0+8.10.0C++ sources with errors such asuint64_t has not been declared, before thememory_probetests ran. The failure appears to be a local/toolchain RocksDB build issue rather than a failure in these tests.Specifications & References
MEMORY_PROVISIONING_PLAN.mdLayer 0: derive and validate the block-sync in-flight memory ceiling from cgroup-aware system memory at startup.Follow-up Work
1.0.AI Disclosure
PR Checklist
type(scope): description