Skip to content

Exempt OOM in dmesg from flaky and targeted integration test checks - #106658

Closed
groeneai wants to merge 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/integration-flaky-oom-exemption
Closed

groeneai wants to merge 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/integration-flaky-oom-exemption

Conversation

@groeneai

@groeneai groeneai commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

Mirror the existing Timeout exemption for OOM in dmesg in ci/jobs/integration_test_job.py. Targeted and flaky integration test checks deliberately overload the runner (--count N for targeted, --dist=each over all changed test modules for flaky), so a host-level OOM under that overload is not attributable to any individual changed test. The dmesg.log is still attached for debugging.

Reported by @alexey-milovidov on #105171 (comment), referencing failing run https://github.com/ClickHouse/ClickHouse/actions/runs/26987765500/job/79643750220.

Related: #105819
Related: #105171

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):

...

Mirror the existing `Timeout` exemption for `OOM in dmesg`. Both flaky and
targeted integration test checks deliberately overload the runner:

- Targeted checks rerun a small set of tests with `--count N`.
- Flaky checks enumerate every changed test under `--dist=each`. A broad
  mechanical diff (e.g. PR ClickHouse#105171, which mechanically touches many integration
  test files) schedules hundreds of test instances; under sanitizer builds the
  parallel overload triggers a host-level kernel OOM that is not attributable
  to any individual changed test.

The synthetic `OOM in dmesg` and `Timeout` results are dropped in those modes;
the `dmesg.log` continues to be attached for debugging.

Reported by @alexey-milovidov on
ClickHouse#105171 (comment),
referencing failing run
https://github.com/ClickHouse/ClickHouse/actions/runs/26987765500/job/79643750220.

Follow-up to ClickHouse#105819 (which added
the soft `FLAKY_CHECK_TIME_LIMIT` and the `Timeout` exemption side of the same
problem).

Related: ClickHouse#105171

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@groeneai

groeneai commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator Author

Pre-PR validation gate

# Question Answer
a Deterministic repro? Yes — the failing run https://github.com/ClickHouse/ClickHouse/actions/runs/26987765500/job/79643750220 produced exactly the synthetic OOM in dmesg FAIL on the integration flaky check for PR #105171. CIDB confirms the unique trigger: SELECT pull_request_number, check_name, count() FROM default.checks WHERE test_name = 'OOM in dmesg' AND test_status = 'FAIL' AND check_name LIKE '%Integration tests%flaky%' AND check_start_time > now() - INTERVAL 30 DAY returns one row, exactly that PR + check + date.
b Root cause explained? The flaky check enumerates every changed test under --dist=each across all xdist workers. PR #105171 mechanically touches many integration test modules, scheduling ~310 test instances on a single host. Under ASan+UBSan that parallel overload triggers a host-level kernel OOM. After PR #105819 fixed the global-timeout half (Timeout is filtered for flaky/targeted), OOM in dmesg is the symmetric synthetic failure that surfaces next; it is created at lines 1055–1059 of ci/jobs/integration_test_job.py and propagated to job status without any flaky/targeted gate.
c Fix matches root cause? Yes — the fix gates the synthetic OOM in dmesg result with the same is_targeted_check or is_flaky_check predicate that already gates Timeout, in the same filter expression. It exactly mirrors the form @alexey-milovidov requested ("mirroring the existing Timeout exemption"). The OOM detection itself remains unchanged on regular checks; only the propagation in flaky/targeted modes is suppressed. The dmesg.log is still attached for debugging visibility regardless of mode.
d Test intent preserved / new tests added? The change does not alter any test assertions or weaken any check. Regular (non-flaky, non-targeted) integration runs continue to fail on real OOMs. Flaky and targeted runs now correctly treat the synthetic OOM as informational (consistent with how they already treat Timeout). No new test added — this is a CI-infrastructure script change for which the existing Timeout exemption already establishes the convention.
e Both directions demonstrated? Without fix: Integration tests (amd_asan_ubsan, flaky) on PR #105171 → OOM in dmesg = FAIL → job FAIL (CIDB confirmed; report linked above). With fix: the same run with this branch applied would still detect the OOM in dmesg, attach the log file, but filter the synthetic OOM in dmesg result alongside Timeout before Result.create_from, so the job is no longer marked failed because of it. The change is local to one filter expression with a one-line list addition.
f Fix is general, not a narrow patch? Yes — the fix targets the symmetric counterpart of an existing exemption rather than a single call site. There is no sibling code path with the same bug pattern: Timeout and OOM in dmesg are the two synthetic results produced unconditionally outside the per-test pipeline (session-timeout from xdist; OOM in dmesg from the post-run kernel-log scan). Both need the same flaky/targeted gate; this PR completes that pairing. The detection of OOM is preserved; only the synthetic FAIL propagation is gated, mirroring the Timeout precedent introduced in #105819.

Session id: cron:clickhouse-ci-task-worker:20260607-030900

@groeneai

groeneai commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator Author

cc @alexey-milovidov @maxknv — could you review this? Mirrors the existing Timeout exemption from #105819 to also drop the synthetic OOM in dmesg result in flaky and targeted integration test checks (where parallel overload triggers a host-level OOM that is not attributable to any individual changed test).

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

clickhouse-gh Bot commented Jun 7, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [fa8442b]

Summary: ✅


AI Review

Summary

This PR mirrors the existing targeted/flaky integration-test exemption for Timeout by also filtering the synthetic OOM in dmesg result before creating the final job result. The actual OOM scan remains in place, regular integration jobs still fail on the synthetic OOM result, and targeted/flaky jobs still preserve real per-test failures plus the attached dmesg.log. I found no correctness issue that needs an inline review comment.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jun 7, 2026

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Questionable.

Even running multiple integration tests in parallel shouldn't lead to OOM.
OOM means we should find a heavy test and make it lighter.

@alexey-milovidov alexey-milovidov self-assigned this Jun 8, 2026
@groeneai

groeneai commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator Author

@alexey-milovidov you are right. Pulled the data and you are right to push back. Path B (find the heavy test, lighten it) is the correct one - closing this PR.

The data

OOM in dmesg is not chronic on these checks:

Window Check Distinct commits / runs OOM-in-dmesg FAIL
30d Integration tests (amd_asan_ubsan, flaky) 1,096 1 (PR #105171)
30d Integration tests (amd_asan_ubsan, targeted) - 0
90d Integration tests (amd_asan_ubsan, flaky) - 2
90d Integration tests (amd_asan_ubsan, targeted) - 23

Mirroring the Timeout exemption was the wrong analogy. Timeout is structurally hit on flaky checks by design (the soft FLAKY_CHECK_TIME_LIMIT). At 1-in-1096, OOM is a real per-PR signal, not background noise.

The heavy test

PR #105171's flaky run had 20 FAILs - all 19 test_storage_delta/* failures show the same shape: PySpark JVM died (spark._sc._jvm AttributeError, spark.range(...).toDF(...) failing in generate_data). That is the OOM signature: kernel kills the JVM, then every subsequent Spark call fails because the SparkContext is dead.

Source of the heaviness - tests/integration/test_storage_delta/test.py:87-88:

.config("spark.driver.memory", "8g")
.config("spark.executor.memory", "8g")

Each test_storage_delta instance reserves 16 GB of JVM heap. Under --dist=each the flaky-check enumerates ~6 test_storage_delta variants ([0,1] x [s3, azure, local]) plus the rest of PR #105171's touched modules onto a single host, and the kernel OOMs the JVMs.

Plan

Closing #106658. Filing a separate PR that lightens test_storage_delta (drop the JVM heap to a value that fits parallel-fanout - e.g. 2g/2g - and verify all variants still pass).

Session id: cron:clickhouse-ci-task-worker:20260608-022700

@groeneai

groeneai commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator Author

Per @alexey-milovidov's pushback - finding heavy test (test_storage_delta JVM 16 GB heap) and lightening it instead. New PR to follow.

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.

2 participants