Repository navigation
Fix flaky test 04103_user_network_bandwidth_throttler - #103586
tiandiwonder merged 1 commit into
Conversation
|
Workflow [PR], commit [c40c8f2] Summary: ❌
AI ReviewSummaryThis PR makes ClickHouse Rules
Final Verdict
|
Add `no-random-settings` tag to prevent CI randomized settings from disabling S3 prefetch (`remote_filesystem_read_prefetch=0`, `allow_prefetched_read_pool_for_remote_filesystem=0`), which can make the natural S3 read rate drop below the 1 MB/s throttle limit. When natural rate < throttle limit, the token bucket never goes negative and the throttler never sleeps, causing `UserThrottlerSleepMicroseconds` to be 0 even though `UserThrottlerBytes` is correctly counted — the third check then fails transiently. Fixes ClickHouse#103422 CI: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=102547&sha=83f565de244bc2f42b2f51098ea6bbef4bcf2c9d&name_0=PR&name_1=Stateless%20tests%20%28amd_tsan%2C%20parallel%2C%202%2F2%29 Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
d5b374f to
c40c8f2
Compare
| # Tags: no-fasttest, long, no-random-settings | ||
| # no-fasttest: needs S3, and the test is slow (exercises throttling) | ||
| # no-random-settings: S3 prefetch settings affect read throughput; disabling prefetch can make | ||
| # natural read rate drop below the 1 MB/s throttle limit, causing the throttler to never sleep |
There was a problem hiding this comment.
And it is not related to max_threads at all, it is OK to disable tests for sanitizers I think for now
And if it will fail after this (for i.e. debug build) then we will have CPU/Real traces, and also let's add trace_profile_events_list='UserThrottlerSleepMicroseconds,UserThrottlerBytes', trace_profile_events=1 and this will allow to make better guesses
There was a problem hiding this comment.
@azat You're right — it's not prefetch-specific; it fails with prefetching enabled too. The real fragility was the throttle limit sitting just below the natural read rate, since fixed by lowering it to 200 KB/s. I've corrected the now-inaccurate no-random-settings comment in a follow-up (the merged PR couldn't be amended): #106947. Thanks for the catch.
|
Dear @arsenmuk, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
961aff5
The test asserts that ProfileEvents['UserThrottlerSleepMicroseconds'] is greater than half of the target query duration. The throttler only sleeps when the natural read rate exceeds the configured throttle limit; when the natural rate drops close to the limit the token bucket never goes negative and the throttler skips its sleep path (see `Throttler::throttle` in `src/Common/Throttler.cpp`). PR ClickHouse#103586 added `no-random-settings` to remove S3-prefetch settings as one source of slow natural rate, but contention on the `Stateless tests (amd_tsan, parallel, 2/2)` runner still occasionally drives the natural S3 read rate close to or below the previous 1 MB/s limit. Post-merge CIDB: `pull_request_number != 0 AND check_start_time > 2026-06-05` shows 4 sightings (PRs ClickHouse#106222, ClickHouse#102039, ClickHouse#49966, ClickHouse#106184) all on amd_tsan parallel 2/2 with the `read 1 1 0` shape (duration ok, bytes ok, sleep below threshold). All four PRs already include the `no-random-settings` tag, so the remaining flakiness is contention-driven, not random-settings driven. Drop the throttle limit and dataset 5x so the throttle is well below any plausible natural rate (200 KB/s vs ~0.9 MB/s observed worst case = 4.5x safety margin). Test wall-clock stays at ~8s. Local 10/10 runs against an S3 disk produced sleep_us between 16.8s and 17.3s, comfortably above the 3.5s threshold. Closes: ClickHouse#103422 Related: ClickHouse#103586 Related: ClickHouse#106184 Co-Authored-By: Claude Opus 4.8 <[email protected]>
Add
no-random-settingstag to fix flaky test04103_user_network_bandwidth_throttler.CI randomized settings can inject
remote_filesystem_read_prefetch=0andallow_prefetched_read_pool_for_remote_filesystem=0, which disable S3 prefetch. On a heavily loaded TSAN machine running parallel tests, this can make the natural S3 read rate drop below the 1 MB/s throttle limit. When natural rate < throttle limit, the token bucket never goes negative and the throttler never sleeps —UserThrottlerSleepMicrosecondsstays at 0 whileUserThrottlerBytesis correctly counted, causing the third check to fail transiently.The write side is unaffected because its data source (
numbers(1e6)) is memory/CPU-bound and always exceeds 1 MB/s regardless of machine load.Fixes #103422
Follow-up for: #103080
CI failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=102547&sha=83f565de244bc2f42b2f51098ea6bbef4bcf2c9d&name_0=PR&name_1=Stateless%20tests%20%28amd_tsan%2C%20parallel%2C%202%2F2%29
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Documentation entry for user-facing changes
Version info
26.6.1.401