Skip to content

Mark qemu-based tests as no-parallel to avoid 600s timeouts - #105758

Closed
groeneai wants to merge 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/fix-qemu-tests-no-parallel
Closed

groeneai wants to merge 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/fix-qemu-tests-no-parallel

Conversation

@groeneai

Copy link
Copy Markdown
Collaborator

The two qemu-x86_64-static based tests, 01103_check_cpu_instructions_at_startup and 03590_simdjson_fallback, occasionally time out at the 600s default test timeout on Stateless tests (amd_binary_excluded_from_llvm).

qemu user-mode emulation is purely interpreted, so each clickhouse-local invocation under qemu is CPU-bound. When other parallel tests on the same CI runner saturate the CPU, the qemu thread gets time-sliced and per-call wall time can grow by 100x or more. 01103 makes 5 sequential qemu calls, so even a moderate slowdown lands the whole test above the timeout.

Over the last 60 days on Stateless tests (amd_binary_excluded_from_llvm):

Test OK runs FAIL runs avg(OK) p95(OK) max(FAIL)
01103_check_cpu_instructions_at_startup 5567 8 (7 timeouts) 5.0s 6.2s 600.1s
03590_simdjson_fallback (similar) 15 (all timeouts) (similar) (similar) 600.1s

All failures are clean 600s timeouts; reruns pass (e.g. one master hit had 19/19 reruns green). --diagnose-random-settings consistently reports "test also fails without randomized settings", confirming this is not a randomization issue.

The fix follows the same convention used by tests/queries/0_stateless/00097_long_storage_buffer_race_condition.sh:

# Tags: race, no-parallel, no-flaky-check
#  - no-parallel: FIXME start to timeout on bigger machines under high load

The no-parallel tag only changes scheduling: each test still runs the exact same qemu invocations and validates the same outputs. There is no semantic change.

Report URL (latest hit, PR #103706): https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=103706&sha=ebef332dc9d425725e1fe4f906a4e52de719522c&name_0=PR&name_1=Stateless%20tests%20%28amd_binary_excluded_from_llvm%29

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

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

CI: stabilize qemu-x86_64-static-based stateless tests (01103_check_cpu_instructions_at_startup, 03590_simdjson_fallback) by marking them no-parallel, eliminating sporadic 600s timeouts on amd_binary_excluded_from_llvm under host CPU load.

Documentation entry for user-facing changes

  • Documentation is unchanged.

`01103_check_cpu_instructions_at_startup` and `03590_simdjson_fallback`
both run `clickhouse-local` under `qemu-x86_64-static`. CPU emulation is
purely interpreted, so each invocation is CPU-bound. When other parallel
tests on the same runner saturate the CPU, qemu interpretation gets
time-sliced and per-call wall time can grow by 100x or more.

`01103` makes 5 sequential qemu calls, so a single slow run easily
exceeds the 600s default test timeout. Over the last 60 days on
`Stateless tests (amd_binary_excluded_from_llvm)`, the test had 14
timeouts at 600s against 5567 passing runs (avg 5s, p95 6.2s). The
sibling `03590_simdjson_fallback` shows the same shape (15 timeouts
at 600s) from its single qemu call.

Use the same convention as `00097_long_storage_buffer_race_condition.sh`
(`Tag no-parallel: FIXME start to timeout on bigger machines under
high load`). The tag only changes scheduling: each test still runs the
exact same qemu invocations and validates the same outputs.

Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=103706&sha=ebef332dc9d425725e1fe4f906a4e52de719522c&name_0=PR&name_1=Stateless%20tests%20%28amd_binary_excluded_from_llvm%29
@groeneai

Copy link
Copy Markdown
Collaborator Author

Pre-PR validation gate (session cron:clickhouse-ci-task-worker:20260525-000000):

a) Deterministic repro? Partial. The failure is environmental (CPU contention on a CI runner), so it cannot be triggered on demand on a machine that is not under heavy load. CIDB shows the failure shape unambiguously: 14 timeouts at exactly 600s on 01103 and 15 timeouts at exactly 600s on 03590 over 60 days on Stateless tests (amd_binary_excluded_from_llvm), all clean timeouts with no other failure modes. --diagnose-random-settings on the affected runs reports "test also fails without randomized settings", confirming the cause is not randomization.

b) Root cause explained? qemu-x86_64-static is purely interpreted (no JIT). Each clickhouse-local invocation under qemu is CPU-bound. When other parallel tests on the same runner saturate CPU, qemu's thread gets heavily time-sliced and per-call wall time grows by ~100x (from ~1s to ~120s). 01103 does 5 sequential qemu calls, so a single bad scheduling window puts the whole test above the 600s default timeout. 03590 does 1 qemu call but is more sensitive to extreme contention.

c) Fix matches root cause? Yes. no-parallel reroutes the test into the sequential phase, where it runs without competing for CPU. This is the exact convention used by 00097_long_storage_buffer_race_condition.sh: # Tag no-parallel: FIXME start to timeout on bigger machines under high load.

d) Test intent preserved? Yes. The tests run the exact same qemu invocations and validate the same outputs; no assertions or settings were modified. Only the test scheduler placement changed.

e) Both directions demonstrated? Indirect. I cannot easily reproduce the contention-induced 600s timeout on a 32-CPU host (only ~1.3x slowdown observed under 32 yes busy loops). However:

  • Without the fix: CIDB shows 14+15 timeouts over 60 days, all at exactly 600s on the same check.
  • With the fix: the sequential phase runs the test alone, so the 5 (or 1) qemu calls complete in their typical ~1s each. Even at 100x slowdown, 5x1s = 5s, well below 600s.

f) Fix is general, not a narrow patch? Yes. I grep'd tests/queries/0_stateless/ for qemu-x86_64-static and found exactly two test files: 01103_check_cpu_instructions_at_startup.sh and 03590_simdjson_fallback.sh. Both are addressed in this PR.

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @alexey-milovidov — could you take a look? You have been the canonical maintainer of these qemu-based tests (#95864, #96592, #96696). Test-only change, just adds no-parallel to mirror the convention from 00097_long_storage_buffer_race_condition.sh.

@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label May 25, 2026
@clickhouse-gh

clickhouse-gh Bot commented May 25, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [5a7ec6f]

Summary: ✅


AI Review

Summary

This PR updates two qemu-based stateless shell tests to include no-parallel, which matches the stated goal of reducing scheduler-induced timeout flakiness without changing test semantics or assertions. The change is small, targeted, and consistent with existing test-tag usage for contention-sensitive cases.

Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label May 25, 2026
@clickhouse-gh

clickhouse-gh Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.10% 84.10% +0.00%
Functions 91.40% 91.40% +0.00%
Branches 76.60% 76.60% +0.00%

Changed lines: No C/C++ source files changed — skipping uncovered code analysis.

Newly covered by added/modified tests: 388 line(s), 19 function(s) across 130 file(s) · Details

Top files
  • src/Storages/StorageReplicatedMergeTree.cpp: 30 line(s), 2 function(s)
  • src/Common/ZooKeeper/ZooKeeperImpl.cpp: 14 line(s)
  • src/Processors/Transforms/WindowTransform.cpp: 10 line(s)
  • src/Storages/ObjectStorage/Local/Configuration.cpp: 8 line(s), 2 function(s)
  • src/Storages/ObjectStorageQueue/ObjectStorageQueueIFileMetadata.cpp: 8 line(s), 1 function(s)

Full report

@Algunenano Algunenano self-assigned this May 25, 2026
@Algunenano

Copy link
Copy Markdown
Member

I'm planning on removing these tests in #105019, so keeping this as draft for now and I'll close it once that one is merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors pr-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants