Skip to content

refactor(server): respect cgroup heap limits - #3320

Merged
imbajin merged 4 commits into
apache:masterfrom
hugegraph:fix/server-cgroup-heap
Oct 12, 2026
Merged

imbajin merged 4 commits into
apache:masterfrom
hugegraph:fix/server-cgroup-heap

Conversation

@imbajin

@imbajin imbajin commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Purpose of the PR

Server launchers size the default heap from host memory, so a memory-limited container can receive a heap larger than its limit. The default calculation now uses the smaller of host availability and remaining memory under visible cgroup hard limits.

Main Changes

Resolve covering cgroup v1/v2 mounts and their visible ancestor limits. Account for reclaimable inactive file cache, using conservative values when statistics are missing or inconsistent. Preserve existing heap bounds and explicit JVM option precedence.

Run License Checker before the Server product plans and required Memory tests in one workflow. Keep both required check names and isolate the Memory plan artifact. Preserve limited automatic retries for required jobs on failed push runs, using the native job rerun API; successful unrelated product jobs are retained.

Verifying these changes

  • Need tests and can be verified as follows:
    • Cgroup fixtures, ShellCheck, existing launcher GC checks, CI policy tests and actionlint passed.
    • Three independent final reviews passed; live Linux warm-cache pressure remains to be validated.
    • Formatting and clean compilation passed with Java 17.
    • A standard Server container limited to 4 GiB started and restarted with the patched sizing helper.

Does this PR potentially affect the following parts?

  • Dependencies
  • Modify configurations
  • The public API
  • Other affects: default Server heap sizing in memory-limited Linux deployments.
  • Nope

Documentation Status

Heap sizing at a glance

The diagram illustrates the default calculation in this change. Explicit heap options retain precedence.
The heap is only part of process memory; native allocations, stacks, and caches still need headroom.
This illustration describes the design, not runtime acceptance or merge readiness.
Cgroup-aware default heap sizing

- bound default heap sizing by remaining cgroup memory
- resolve controller mounts and visible ancestor limits
- add memory sizing regression checks to server CI

@imbajin imbajin left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent review of this head: 7.0/10; hold for the two P2 fixes below, then re-review. The supplied shell fixture suite and bash syntax check passed independently. Two additional bounded cloud fixtures reproduced the decision paths described inline. No real container restart, memory-pressure test, full Java build, or RC acceptance was run in this review. The author's container validation remains separate evidence. CI was still running when reviewed.

Comment thread hugegraph-server/hugegraph-dist/src/assembly/static/bin/util.sh Outdated
Comment thread hugegraph-server/hugegraph-dist/src/assembly/static/bin/util.sh
@codecov

codecov Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.51%. Comparing base (6aa362a) to head (919aa62).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3320      +/-   ##
============================================
+ Coverage     52.42%   52.51%   +0.09%     
- Complexity     2273     2374     +101     
============================================
  Files           762      762              
  Lines         67400    67431      +31     
  Branches       9138     9151      +13     
============================================
+ Hits          35333    35410      +77     
+ Misses        28525    28488      -37     
+ Partials       3542     3533       -9     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- retain limits across covering cgroup mount views
- account for reclaimable cache with conservative guards
- run required Memory tests after License Checker
- remove retired workflows and verify the result gate
- restore the trusted and limited retry workflow
- select required jobs from the current failed attempt
- rerun selected producers and their dependent jobs
- preserve source guards and paused PR retries
- stop the monitor before shutting down its fixture
- verify the foreground PID belongs to its wrapper
- retain signal assertions and report failed ownership
@imbajin imbajin changed the title fix(server): respect cgroup heap limits refactor(server): respect cgroup heap limits Oct 12, 2026
@imbajin
imbajin merged commit 68fb045 into apache:master Oct 12, 2026
32 of 33 checks passed
@imbajin
imbajin deleted the fix/server-cgroup-heap branch October 12, 2026 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants