Skip to content

Revert "Lower max_server_memory_usage_to_ram_ratio to 0.7 on sanitizer stateless runs" - #110572

Merged
alexey-milovidov merged 1 commit into
masterfrom
revert-110293-fix-sanitizer-stateless-oom-memory-ratio
Jul 15, 2026
Merged

alexey-milovidov merged 1 commit into
masterfrom
revert-110293-fix-sanitizer-stateless-oom-memory-ratio

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Jul 15, 2026 •

Copy link
Copy Markdown
Member

Reverts #110293

Version info

  • Merged into: 26.7.1.982 (included in 26.7 and later)

@alexey-milovidov alexey-milovidov self-assigned this Jul 15, 2026
@alexey-milovidov
alexey-milovidov merged commit 73f924a into master Jul 15, 2026
1 check failed
@alexey-milovidov
alexey-milovidov deleted the revert-110293-fix-sanitizer-stateless-oom-memory-ratio branch July 15, 2026 15:03
@clickhouse-gh

clickhouse-gh Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [1513e3b]

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Jul 15, 2026
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 15, 2026
pull Bot pushed a commit to CrazyForks/ClickHouse that referenced this pull request Jul 18, 2026
…oncurrency

Re-applies the sanitizer `max_server_memory_usage_to_ram_ratio` of 0.7 from
ClickHouse#110293 (reverted in ClickHouse#110572 because it caused a flood of
`MEMORY_LIMIT_EXCEEDED` in the "Stateless tests (amd_asan_ubsan, distributed
plan, parallel)" job on master), and this time also lowers the test concurrency
for that job so the *aggregate* server memory of concurrent queries fits under
the cap.

ClickHouse#110293 lowered the ratio to 0.7 to stop the host OOM killer from reaping the
server ("Server died") on the heaviest sanitizer stateless configs, where
~17 GiB of concurrent ASan `clickhouse-client` processes plus a 0.9-of-RAM
server exceed the 60 GiB host. That reasoning only accounted for the largest
single query (~25 GiB), but in the parallel runner dozens of test queries share
one server, so the server memory tracker sees the aggregate, and
`--distributed-plan` fans each query across local parallel replicas,
multiplying per-query server memory. The aggregate then exceeds the lowered
41.84 GiB cap and the `OvercommitTracker` rejects queries across all
co-scheduled tests (Code 241, `MEMORY_LIMIT_EXCEEDED`), so hundreds of
unrelated tests failed on master with 6-213 failures per run.

Fix:
- Re-apply `set_memory_ratio(0.7)` for every sanitizer stateless run.
- Cut the parallel distributed-plan sanitizer job's concurrency to 0.35 * CPU
  (below the 0.4 that azure already uses for the identical failure mode), so
  the aggregate concurrent RSS stays under the cap. The reduction is gated to
  sanitizer builds, since only they carry the 0.7 cap; the healthy
  non-sanitizer (amd_debug) distributed-plan parallel job is left at the
  default concurrency.
- Raise that job's timeout from 2.5h to 3h so the reduced throughput (the job
  runs ~80 min at 0.6 * CPU) cannot turn a memory-red into a timeout-red.

CI report of the disaster (master, Code 241 flood):
https://play.clickhouse.com/play?user=play&run=1&color_modes=%7B%22ppm%22%3A%22none%22%2C%22test_name%22%3A%22categorical%22%7D&tab=Failed%20checks#U0VMRUNUIGNoZWNrX3N0YXJ0X3RpbWUsIGNoZWNrX25hbWUsIHRlc3RfbmFtZSwgcmVwb3J0X3VybApGUk9NIGNoZWNrcwpXSEVSRSAxCiAgICBBTkQgY2hlY2tfc3RhcnRfdGltZSA+PSBub3coKSAtIElOVEVSVkFMIDI0IEhPVVIKICAgIEFORCAoaGVhZF9yZWYgPSAnbWFzdGVyJyBBTkQgc3RhcnRzV2l0aChoZWFkX3JlcG8sICdDbGlja0hvdXNlLycpKQogICAgQU5EIHRlc3Rfc3RhdHVzICE9ICdTS0lQUEVEJwogICAgQU5EICh0ZXN0X3N0YXR1cyBMSUtFICdGJScgT1IgdGVzdF9zdGF0dXMgTElLRSAnRSUnKQogICAgQU5EIGNoZWNrX3N0YXR1cyAhPSAnc3VjY2VzcycKT1JERVIgQlkgY2hlY2tfc3RhcnRfdGltZSBERVNDLCBjaGVja19uYW1lLCB0ZXN0X25hbWU7

Related: ClickHouse#108689
Related: ClickHouse#110293
Related: ClickHouse#110572

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
huldarchen pushed a commit to huldarchen/ClickHouse that referenced this pull request Sep 3, 2026
The fuzzer jobs give one unbounded container a whole shared runner:
get_run_command passes no --memory, and inside the container only
max_server_memory_usage_to_ram_ratio is set while max_server_memory_usage stays
0, so the server sizes itself from the host (46.33 of 61.78 GiB). On PR ClickHouse#116666
the container reached "current RSS: 57.14 GiB" against "maximum: 46.18 GiB"
while every query was refused with Code 241. That RSS is the container cgroup's
anon, so it charges clickhouse-client and two gdb processes as well, and the
server's own ratio cannot bound it. About 4.6 GiB was left for the runner agent;
it lost communication, the Run step concluded cancelled, and since upload
happens after Run the job published nothing. CI DB has 0 rows for
AST fuzzer (amd_debug, targeted) at that commit, while the twin
old_compatibility arm fuzzed the same two query files against the same diff at
the same commit and passed.

--memory is a kernel bound on the whole container, so the reserve holds whatever
the server, gdb and the client do. The launcher stays outside the container, so
an in-container kill leaves it alive to publish a result. The derived form
follows ci/defs/job_configs.py and adapts to both runner classes; 8 GiB rather
than that file's 2 GiB because the agent lost communication with 4.64 GiB still
available, and the runner's at-rest footprint is already about 2.4 GiB.

max_server_memory_usage_to_ram_ratio is deliberately unchanged and becomes an
inner margin: the container cap is 53.78 GiB and the server ceiling 40.33
instead of 46.33 GiB. Lowering that ratio was tried and reverted before
(ClickHouse#110293, reverted by ClickHouse#110572) for flooding unrelated tests with
MEMORY_LIMIT_EXCEEDED.

Validated locally: the flag binds a container carrying this job's exact flags
including --privileged, and ClickHouse then reports the container size rather
than the host's (8.00, 4.00 and 16.00 GiB as the cap varies, 755.49 GiB with no
flag, and 8.00 down to 3.00 GiB through the cgroups v1 code path); 2 GiB of anon
in a 512 MiB container of this shape is killed by the kernel and succeeds
uncapped; all 10 fuzzer job digests change while 164 other PR jobs do not; and
pytest ci/tests/ has identical pass/fail sets with and without the change.

Related: ClickHouse#111892

Co-Authored-By: Claude Opus 5 <[email protected]>
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…x-sanitizer-stateless-oom-memory-ratio

Revert "Lower max_server_memory_usage_to_ram_ratio to 0.7 on sanitizer stateless runs"
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…oncurrency

Re-applies the sanitizer `max_server_memory_usage_to_ram_ratio` of 0.7 from
ClickHouse#110293 (reverted in ClickHouse#110572 because it caused a flood of
`MEMORY_LIMIT_EXCEEDED` in the "Stateless tests (amd_asan_ubsan, distributed
plan, parallel)" job on master), and this time also lowers the test concurrency
for that job so the *aggregate* server memory of concurrent queries fits under
the cap.

ClickHouse#110293 lowered the ratio to 0.7 to stop the host OOM killer from reaping the
server ("Server died") on the heaviest sanitizer stateless configs, where
~17 GiB of concurrent ASan `clickhouse-client` processes plus a 0.9-of-RAM
server exceed the 60 GiB host. That reasoning only accounted for the largest
single query (~25 GiB), but in the parallel runner dozens of test queries share
one server, so the server memory tracker sees the aggregate, and
`--distributed-plan` fans each query across local parallel replicas,
multiplying per-query server memory. The aggregate then exceeds the lowered
41.84 GiB cap and the `OvercommitTracker` rejects queries across all
co-scheduled tests (Code 241, `MEMORY_LIMIT_EXCEEDED`), so hundreds of
unrelated tests failed on master with 6-213 failures per run.

Fix:
- Re-apply `set_memory_ratio(0.7)` for every sanitizer stateless run.
- Cut the parallel distributed-plan sanitizer job's concurrency to 0.35 * CPU
  (below the 0.4 that azure already uses for the identical failure mode), so
  the aggregate concurrent RSS stays under the cap. The reduction is gated to
  sanitizer builds, since only they carry the 0.7 cap; the healthy
  non-sanitizer (amd_debug) distributed-plan parallel job is left at the
  default concurrency.
- Raise that job's timeout from 2.5h to 3h so the reduced throughput (the job
  runs ~80 min at 0.6 * CPU) cannot turn a memory-red into a timeout-red.

CI report of the disaster (master, Code 241 flood):
https://play.clickhouse.com/play?user=play&run=1&color_modes=%7B%22ppm%22%3A%22none%22%2C%22test_name%22%3A%22categorical%22%7D&tab=Failed%20checks#U0VMRUNUIGNoZWNrX3N0YXJ0X3RpbWUsIGNoZWNrX25hbWUsIHRlc3RfbmFtZSwgcmVwb3J0X3VybApGUk9NIGNoZWNrcwpXSEVSRSAxCiAgICBBTkQgY2hlY2tfc3RhcnRfdGltZSA+PSBub3coKSAtIElOVEVSVkFMIDI0IEhPVVIKICAgIEFORCAoaGVhZF9yZWYgPSAnbWFzdGVyJyBBTkQgc3RhcnRzV2l0aChoZWFkX3JlcG8sICdDbGlja0hvdXNlLycpKQogICAgQU5EIHRlc3Rfc3RhdHVzICE9ICdTS0lQUEVEJwogICAgQU5EICh0ZXN0X3N0YXR1cyBMSUtFICdGJScgT1IgdGVzdF9zdGF0dXMgTElLRSAnRSUnKQogICAgQU5EIGNoZWNrX3N0YXR1cyAhPSAnc3VjY2VzcycKT1JERVIgQlkgY2hlY2tfc3RhcnRfdGltZSBERVNDLCBjaGVja19uYW1lLCB0ZXN0X25hbWU7

Related: ClickHouse#108689
Related: ClickHouse#110293
Related: ClickHouse#110572

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-not-for-changelog This PR should not be mentioned in the changelog pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants