morningman opened a new pull request, #71201:
URL: https://github.com/apache/doris/pull/71201

   ### Background
   
   `GlobalMemoryArbitrator::is_exceed_soft_mem_limit(bytes)` reports process 
memory pressure when the process memory plus `bytes` reaches the soft limit, or 
when the system available memory minus `bytes` falls below 
`MemInfo::sys_mem_available_warning_water_mark()`; the hard-limit check uses 
the low water mark the same way. `MemInfo::init()` sets both water marks only 
on Linux, and only when `/proc/meminfo` has `MemAvailable`; otherwise, as on 
macOS, they stay `INT64_MIN` and that side of the checks never fires. The 
`PROCESS_MEMORY_EXCEEDED` cases of `WorkloadGroupManagerTest` (#67845) drive 
both sides of these checks.
   
   ### What problem does this PR solve?
   
   Issue Number: None
   
   Related PR: #67845 (added the case)
   
   PR Type: Test
   
   Problem Summary:
   
   `process_mem_exceeded_resumes_when_reservation_fits_sys_mem_available` sets 
the system available memory 16 MiB above the runner's warning water mark, to 
check that a paused query resumes once its recorded 1 KiB reservation fits 
although a 32 MiB probe would not, and first asserts that this water mark is 
positive. On macOS it is `INT64_MIN`, so the case fails on every local run:
   
   ```
   Expected: (MemInfo::sys_mem_available_warning_water_mark()) > (0), actual: 
-9223372036854775808 vs 0
   ```
   
   A Linux runner whose `/proc/meminfo` has no `MemAvailable`, or whose low 
water mark computes to 0 (`mem_limit` at or above the physical memory), would 
fail the same way. The fixture now sets both water marks itself (512 MiB and 1 
GiB) in SetUp and restores them in TearDown, as it already does for the memory 
limits and the system available memory, and the case is written against that 
value. Only test code changes.
   
   ### Details
   
   - **Failure:** macOS arm64, ASAN, `run-be-ut.sh --run 
--filter='WorkloadGroupManagerTest.*'` at master `290b8adce77`: 51 of 52 cases 
pass and this one fails at the assertion above, on every run. No CI job runs 
the BE unit tests on macOS (`.github/workflows/be-ut-mac.yml` only compiles the 
BE), so only local runs on a Mac show it; the Linux BE UT pipeline passes.
   - **Cause:** the environment: the case uses the water marks that 
`MemInfo::init()` computed from the runner, and the macOS `MemInfo::init()` 
computes none.
   - **Stability evidence:** the failure is deterministic, so the evidence is a 
run before and after the change plus a mutation, on macOS arm64 with ASAN. With 
the change all 52 cases pass, also in 20 shuffled iterations 
(`--gtest_repeat=20 --gtest_shuffle`). The case still catches the regression it 
was written for: when the resume checks of `WorkloadGroupMgr` test 
`max(reservation, 32 MiB)`, the probe #67845 replaced, the case fails at 
`_assert_resumed` (the query is cancelled after its 60 s wait), as does its 
soft-limit sibling; before the change it failed at the water mark assertion 
whatever the code did.
   
   ### Testing
   
   - macOS arm64, ASAN, `run-be-ut.sh --run 
--filter='WorkloadGroupManagerTest.*'`: at master `290b8adce77` 51 passed and 
this case failed; with this PR 52 passed, also in 20 shuffled iterations.
   - The mutation above, applied locally and reverted: this case and 
`process_mem_exceeded_resumes_when_reservation_fits_soft_limit` fail, the other 
50 cases pass.
   - Linux: not run locally; the BE UT pipeline runs this suite.
   
   ### Notes for Reviewers
   
   - The water marks are written directly 
(`MemInfo::_s_sys_mem_available_low_water_mark` and 
`_s_sys_mem_available_warning_water_mark`): `doris_be_test` is compiled with 
`-fno-access-control`, and `parse_util_test.cpp` already sets 
`MemInfo::_s_physical_mem` this way. The alternative was another 
`set_*_for_test` hook in `util/mem_info.h`, next to the existing ones; about 
900 objects of the BE UT build depend on that header and would be rebuilt for a 
test-only change.
   - The removed `ASSERT_GT(MemInfo::sys_mem_available_warning_water_mark(), 
0)` checked the runner; the `ASSERT_TRUE(is_exceed_soft_mem_limit(32 MiB))` 
that follows still shows that the water mark is in effect, since the process 
limits have their whole headroom at that point.
   - The other 51 cases keep the system available memory at `INT64_MAX / 2` 
(SetUp and `_relieve_process_mem_limit()`), far above any water mark, so the 
fixed water marks change none of their checks.
   - branch-4.2 has the same case (#70432).
   
   ### Release note
   
   None
   
   ### Check List (For Author)
   
   - Behavior changed: No
   - Does this need documentation: No
   - Pre-submission status: Partially verified: not run on Linux locally; the 
BE UT pipeline runs this suite
   
   ### AI Disclosure
   
   - Tool: Claude Code (Claude Opus 5.5)
   - Generated: the test change and this description
   - Human review: not stated
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to