Skip to content

CI: cap the RustFS blocking-thread pool on the CAS-S3 lanes and collect its log - #2384

Merged
filimonov merged 1 commit into
antalya-26.6from
fix/antalya-26.6/ci-rustfs-runtime-knobs
Sep 17, 2026
Merged

filimonov merged 1 commit into
antalya-26.6from
fix/antalya-26.6/ci-rustfs-runtime-knobs

Conversation

@filimonov

Copy link
Copy Markdown
Member

CI only, one file (ci/jobs/scripts/clickhouse_proc.py, start_rustfs): environment knobs for the RustFS instance that backs the CAS-S3 stateless lanes, plus routing its log into the existing rustfs.log artifact. No server code, no test changes.

Why RustFS memory counts as ClickHouse memory. The stateless job runs the server, MinIO, azurite, RustFS and the test workers in one docker container, i.e. one cgroup, with no --memory flag. The server's MemoryWorker uses the cgroup source, which sums the whole cgroup's anon from memory.stat, and max_server_memory_usage is derived from the host (0.9 × 30.6 GiB). So every byte RustFS allocates is charged against the server's limit: it inflates MemoryTracking, drives the memory-capped max_threads, and under ASan produced the Code: 241 storms.

Why RustFS grows. RustFS 1.0.0-rc.3 runs every disk I/O through tokio's spawn_blocking: under the default strict durability a PUT costs four or more blocking dispatches (write, fsync chain, rename). The blocking pool grows one thread per concurrent dispatch, an idle thread lives 60 s, and each thread pins about 12 MB of retained mimalloc arena plus a 1 MiB stack. Under a parallel test suite the pool only ratchets up: on a three-hour MSan shard it reached 1074 threads and 14 GB of anonymous memory (r = 0.95 between thread count and RSS). The same mechanism also made rename_data cost 37–69 ms per call.

Knobs

Variable Value What it does Expected effect on the shard
RUSTFS_RUNTIME_MAX_BLOCKING_THREADS 64 Hard cap on the tokio blocking pool (default unbounded up to 512+) Bounds the thread-owned memory to ~130 threads / ~2 GB instead of 1074 / 14 GB
RUSTFS_RUNTIME_THREAD_KEEP_ALIVE 5 Idle blocking threads exit after 5 s instead of 60 s The pool shrinks between test bursts instead of ratcheting
RUSTFS_ALLOCATOR_RECLAIM_ENABLED true Periodic mimalloc arena return to the OS (default off) Freed arenas leave RSS instead of staying retained
RUSTFS_ALLOCATOR_RECLAIM_INTERVAL_SECS 30 Reclaim period Keeps the reclaim cheap and regular
RUSTFS_DURABILITY_MODE relaxed No fsync chain on commit; 2 blocking dispatches per PUT instead of 4+ Removes the 37–69 ms rename_data and halves thread demand. Acceptable for CI: the pool lives under ci/tmp and is wiped per run
RUSTFS_OBS_USE_STDOUT true RustFS writes its log (error level by default) to stdout The already-uploaded rustfs.log artifact gets content; today RustFS writes to logs/ under its cwd and the artifact is nearly empty

Local measurement (same six-pass workload of the MSan CAS-S3 shard, CI MSan binary, two RustFS instances; knobs applied to the CAS instance only, the other one as control):

without knobs with knobs
wall time, six passes 205 min 143 min
RustFS threads, max 1074 130
RustFS anonymous memory, max 15.2 GB 2.55 GB
rename_data per call 44–69 ms 0.5–0.8 ms
Code: 241 in test output 12 4
test median / p90, first → last sixth 2.90/17.0 → 3.77/23.2 s 1.85/9.7 → 2.61/12.9 s

The five memory knobs were measured together, so their individual contributions are not separated; the durability knob is the one with a semantic cost and is intended for CI only. The RustFS log volume at error level was 1.5 MB over 143 minutes.

Related: #2298

Changelog category (leave one):

  • CI Fix or improvement

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

CI: cap the RustFS blocking-thread pool and enable allocator reclaim on the CAS-S3 stateless lanes, so the object store no longer inflates the server's cgroup memory; collect the RustFS log as an artifact.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

CI/CD Options

Exclude tests:

  • Fast test
  • Integration Tests
  • Stateless tests
  • Stateful tests
  • Unit tests
  • Performance tests
  • Aarch64 tests
  • All with ASAN
  • All with TSAN
  • All with MSAN
  • All with UBSAN
  • All with Coverage
  • All Regression
  • Disable CI Cache

Regression jobs to run:

  • Fast suites (mostly <1h)
  • Aggregate Functions (2h)
  • Alter (1.5h)
  • Benchmark (30m)
  • CAS (content-addressed storage; Antalya only)
  • ClickHouse Keeper (1h)
  • Iceberg (2h)
  • LDAP (1h)
  • OAuth (5m)
  • Parquet (1.5h)
  • RBAC (1.5h)
  • SSL Server (1h)
  • S3 (2h)
  • S3 Export (2h)
  • Swarms (30m)
  • Tiered Storage (2h)

🤖 Generated with Claude Code

https://claude.ai/code/session_01GhVd7eMAWdFubNk4g1B2Tx

…b artifact

RustFS shares the job container's cgroup with the ClickHouse server, so its memory
is charged against `max_server_memory_usage`. RustFS 1.0.0-rc.3 grows its tokio
blocking-thread pool one thread per concurrent blocking dispatch and keeps idle
threads for 60 s; each thread pins about 13 MB. On the MSan CAS-S3 stateless shards
this reached 1074 threads and 14 GB of anonymous memory over three hours.

Set the runtime knobs that cap the pool and let it shrink, enable allocator
reclaim, and use relaxed durability (no fsync chain; the pool is wiped per run).
Measured locally on the same six-pass workload: 1074 -> 130 threads, 14.4 GB ->
2.5 GB anonymous, `rename_data` 44-69 ms -> 0.6 ms, the run 30% faster.

`RUSTFS_OBS_USE_STDOUT=true` routes the RustFS log (error level by default) into
`rustfs.log`, which the job already uploads; without it RustFS writes under its cwd
and the artifact stays empty.

Related: #2298

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GhVd7eMAWdFubNk4g1B2Tx
Signed-off-by: Mikhail Filimonov <[email protected]>
@github-actions

Copy link
Copy Markdown

Workflow [PR], commit [e283ead]

@filimonov
filimonov merged commit 2f4f092 into antalya-26.6 Sep 17, 2026
240 of 247 checks passed
@alsugiliazova

Copy link
Copy Markdown
Member

PR #2384 Distributed-Systems Audit

AI audit note: This review was generated by AI (Claude Opus 5.5).

Field Value
PR Altinity/ClickHouse#2384 — CI: cap the RustFS blocking-thread pool on the CAS-S3 lanes and collect its log
Base antalya-26.6
Head e283eadcf3d25ec1a122188d1abb9f47905dd4a9
State Merged
Scope Environment variables passed to the RustFS process in ci/jobs/scripts/clickhouse_proc.py (start_rustfs)
Method distributed-systems-audit, static review
Related PR-2384-CI-TRIAGE.md

No confirmed distributed-systems defects in reviewed scope.

Model assumptions

Actors One ClickHouse server and one RustFS process, both in the same CI job container. RustFS is the S3 stand-in for the CAS lanes.
Channels S3 HTTP from ClickHouse to 127.0.0.1:11121. No Keeper, no second node, no replication protocol.
Failure model assumed by the code The pool is ephemeral and wiped when the job ends. RustFS may stall or be killed. A successful PUT is durable against process death (the data is in the kernel page cache) and is not durable against power loss of the runner.

The one contract change is RUSTFS_DURABILITY_MODE=relaxed, previously the RustFS default strict. RustFS documents relaxed as skipping fsync of xl.meta, rollback backups, and the parent directory of the commit rename, while still fdatasyncing the object payload (durability-modes.md). A recently acknowledged object can disappear if the runner loses power. Killing the RustFS process does not drop the page cache, so it does not lose those writes. CI does not resume a job after the runner dies, and the pool is discarded with the job. That is the tradeoff the change comments on, not a defect in this scope.

RUSTFS_RUNTIME_MAX_BLOCKING_THREADS=64 can queue blocking I/O past 64 in-flight operations. A stall long enough to miss the CAS mount-lease renewal fences the disk. The same lease loss already happens on these lanes without this change (see the CI triage), so the cap is not shown to be the cause.

Coverage summary

Fault class Status Notes
Network / transport Reviewed No client timeout or retry code changed. RustFS still serves the same port.
Partition / availability Reviewed Single process on localhost. The thread cap is the stall risk above, and it is not confirmed as a new failure.
Timing / ordering N/A No clocks, epochs, or cross-node ordering.
Partial / gray failure Reviewed Durability mode, above.
Idempotency & duplicates N/A No retried write was added.
Backpressure & resource limits Reviewed The cap and the allocator reclaim are the change. They bound a pool that was measured at 1074 threads and 14 GB.
Recovery & rollback Reviewed No restart-and-replay path. A dead runner does not resume the job.
Configuration & version skew N/A One process, one job, no mixed versions. An invalid durability value would fall back inside RustFS; relaxed is a valid value.
Security / trust N/A Credentials stay clickhouse / clickhouse on localhost, as before.
Observability Reviewed RUSTFS_OBS_USE_STDOUT=true sends the RustFS log to the rustfs.log artifact that the job already collects.

Limits. Static review of the diff and of the RustFS durability document at 286bbb8e. RustFS itself was not built or run.

@alsugiliazova

Copy link
Copy Markdown
Member

PR #2384 CI Verification Report

Verification (2026-09-24)

Field Value
PR Altinity/ClickHouse#2384 — CI: cap the RustFS blocking-thread pool on the CAS-S3 lanes and collect its log
Base antalya-26.6
Head e283eadcf3d25ec1a122188d1abb9f47905dd4a9
State Merged
Run 35080661103
Diff ci/jobs/scripts/clickhouse_proc.py only
Method pr-ci-failure-triage + DB rates (gh-data.checks) + the shard 1 job log, clickhouse-server.err.log, and dmesg.log

Verdict

No failure is caused by this PR. The change is a CI script. None of the red checks exercise it in a way that explains the failure.

Category Checks Caused by #2384?
regression 0 —
unknown 0 —
infrastructure 1 — Source upload No
pre-existing-flaky 1 — Stateless amd_msan, cas s3 storage, 1/3 No
infrastructure 2 — Stateless amd_msan, cas s3 storage, 2/3 and 3/3 No. Cancelled at the 6 hour limit. These checks fail on essentially every recorded run.

Source upload

Category: infrastructure

The job failed at Checkout submodules. Git could not read GitHub credentials and aborted cloning contrib/chdig (and the same error hit contrib/wasmtime and ai-sdk-cpp):

fatal: could not read Username for 'https://github.com': No such device or address
fatal: clone of 'https://github.com/azat/chdig.git' into submodule path '.../contrib/chdig' failed

The same check fails on other PRs (66 of 684 commits) and on antalya-26.6 (3 of 35). One failure here is what that rate predicts. The diff does not touch the checkout.

Stateless MSan CAS shard 1

Category: pre-existing-flaky

The report is Failed: 4, Passed: 1779. The four tests are UNKNOWN, not assertion failures, and all four are the same error, starting at 17:08:01:

Code: 210. content-addressed disk 'cas_s3' -- mount lease not held

The server log shows why, one second earlier:

CasMountLeaseRenewer: CAS mount renewal 'stateless-ca-s3' fenced after 0 physical attempts
in 148 ms (classification=external_lease_deadline)

The lease deadline had already passed, so the disk stopped accepting writes. The four tests (02012_zookeeper_changed_enum_type, 03095_merge_and_buffer_tables, 02911_support_alias_column_in_indices, 03100_lwu_10_apply_on_merges) are that one incident. The same signature has been failing CAS suites since August and is tracked for an earlier PR as #2332.

Server died on this check is the harness label, not a crash:

  • clickhouse-server.err.log has no <Fatal>, no Killed by signal, and no MemorySanitizer report. The server was still logging at 17:12, after the lease drop.
  • dmesg has one segfault, and it is lldb, which the runner had launched to take a stack trace and which then timed out.
  • The Terminated / exit 143 lines are the runner tearing the job down, not the server.

This check reports Server died on 2 of 2 branch commits and 10 of 12 other-PR commits in the last 60 days. This run is that baseline.

The ten BROKEN tests are marked KNOWN: Random timeout with sanitizer and do not fail the job.

Stateless MSan CAS shards 2 and 3

Category: infrastructure

GitHub shows both as failed. The Actions conclusion is cancelled. Each ran from 11:39 to 17:40 UTC, six hours, and produced no test rows. That is the job time limit.

On the runs that do finish, the same two checks fail anyway: shard 2/3 has a Server died or Timeout row on 10 of 10 other-PR commits and 1 of 1 branch commits, and shard 3/3 on 8 of 8 and 1 of 1.

@alsugiliazova alsugiliazova added the verified Approved for release label Sep 24, 2026
@svb-alt svb-alt added the port-antalya PRs to be ported to all new Antalya releases label Sep 29, 2026
zvonand pushed a commit that referenced this pull request Oct 1, 2026
…time-knobs

CI: cap the RustFS blocking-thread pool on the CAS-S3 lanes and collect its log
Source-PR: #2384 (#2384)
zvonand pushed a commit that referenced this pull request Oct 1, 2026
…time-knobs

CI: cap the RustFS blocking-thread pool on the CAS-S3 lanes and collect its log
Source-PR: #2384 (#2384)
zvonand pushed a commit that referenced this pull request Oct 8, 2026
…time-knobs

CI: cap the RustFS blocking-thread pool on the CAS-S3 lanes and collect its log
Source-PR: #2384 (#2384)
@zvonand zvonand removed the port-antalya PRs to be ported to all new Antalya releases label Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants