Repository navigation
Reduce Spark JVM heap in delta-lake integration tests to fix OOM under flaky-check --dist=each - #106698
Conversation
…g/2g Under integration `flaky` and `targeted` checks, pytest is launched with `--dist=each`, which spawns N xdist workers (typically 12 on the CI runner, sized by `min(ncpu/MAX_CPUS_PER_WORKER, mem_gb/MAX_MEM_PER_WORKER)`), each running its own isolated Docker cluster with a fresh PySpark JVM. `get_spark` in the three delta-lake integration tests pinned `spark.driver.memory` and `spark.executor.memory` to `8g` each, i.e. 16 GiB of JVM heap per worker. With 12 workers under flaky-check `--dist=each` plus ASan+UBSan overhead in the ClickHouse processes themselves, the host runs out of memory and the kernel kills the JVMs, after which every subsequent Spark call from `generate_data` fails (`spark._sc._jvm` AttributeError) and the runner records an `OOM in dmesg` synthetic failure. This is what happened on the flaky check for PR ClickHouse#105171 (run https://github.com/ClickHouse/ClickHouse/actions/runs/26987765500/job/79643750220): 19 `test_storage_delta/*` failures, all sharing the dead-JVM signature, plus the synthetic `OOM in dmesg`. The data the tests actually feed Spark is tiny: `generate_data` calls top out at `spark.range(0, 1300)`, and most call sites use 100 rows or fewer. The 8g/8g heap was added in commit `0302eb0c3af` (2025-08-29, "Try fix spark out of memory") to address per-process Spark OOM on a different code path, but 4 GiB total per JVM (driver+executor at 2g each) leaves comfortable headroom above the 1g/1g Spark default while making 12-worker `--dist=each` runs fit: 12 × 4 GiB = 48 GiB, well under the runner's ~256 GiB. Apply the same change to all three delta-lake test files that share the 8g/8g pattern (`test_storage_delta/test.py`, `test_storage_delta/test_cdf.py`, `test_storage_delta_disks/test.py`) so the same OOM does not surface on any PR that touches one of the sibling files. `test_storage_iceberg/test.py` and `test_storage_iceberg_disks/test.py` already use Spark defaults (no `spark.driver.memory` / `spark.executor.memory` config), so they do not need a similar change. Related: ClickHouse#105171 (originating run). Co-Authored-By: Claude Opus 4.8 <[email protected]>
Pre-PR validation gate
Session id: cron:clickhouse-ci-task-worker:20260608-040000 |
|
cc @alexey-milovidov @kssenii — could you review this? Path B follow-up to the OOM-in-dmesg directive on #105171 (closed PR #106658 was Path A). Lightens the per-process Spark JVM heap in the three delta-lake integration tests ( |
|
Workflow [PR], commit [7406d0a] Summary: ✅ AI ReviewSummaryThis PR lowers Missing context / blind spots
Final VerdictStatus: ✅ Approve No review changes requested. The pending targeted/flaky integration jobs should still complete before merge. |
LLVM Coverage Report
Changed lines: No C/C++ source files changed — skipping uncovered code analysis. Newly covered by added/modified tests: 387 line(s), 14 function(s) across 141 file(s) · Details Top files
|
The flaky/targeted integration checks schedule the parallel bucket with
`-n {workers} --dist=each`, so every xdist worker runs every parallel module
at once. On AMD_MEDIUM (16 cpu, 61 GiB) workers = min(16//5, 61//11) = 3.
test_storage_delta/test.py starts a 5-node ClickHouse cluster plus a Spark JVM
in its module-scoped fixture; three concurrent copies meant ~15 ASan servers +
3 JVMs on 61 GiB and a kernel OOM that surfaced as an in-test hang. Reducing the
per-JVM heap (8g -> 2g, ClickHouse#106698) helped but did not remove the concurrency
driver.
Move the heavy delta modules (test_storage_delta/test.py,
test_storage_delta/test_cdf.py, test_storage_delta_disks/test.py) out of the
`--dist=each` parallel bucket into the looped sequential bucket (`-n 1`, repeated
>=3x) for the flaky/targeted path only. At most one delta cluster runs at a time,
so the OOM driver is gone while the flakiness signal is preserved. Normal runs
use `--dist=loadfile` (one file -> one worker -> one cluster) and never call this,
so they are unaffected.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
The flaky/targeted integration checks schedule the parallel bucket with
`-n {workers} --dist=each`, so every xdist worker runs every parallel module
at once. On AMD_MEDIUM (16 cpu, 61 GiB) workers = min(16//5, 61//11) = 3.
test_storage_delta/test.py starts a 5-node ClickHouse cluster plus a Spark JVM
in its module-scoped fixture; three concurrent copies meant ~15 ASan servers +
3 JVMs on 61 GiB and a kernel OOM that surfaced as an in-test hang. Reducing the
per-JVM heap (8g -> 2g, ClickHouse#106698) helped but did not remove the concurrency
driver.
Move the heavy delta modules (test_storage_delta/test.py,
test_storage_delta/test_cdf.py, test_storage_delta_disks/test.py) out of the
`--dist=each` parallel bucket into the looped sequential bucket (`-n 1`, repeated
>=3x) for the flaky/targeted path only. At most one delta cluster runs at a time,
so the OOM driver is gone while the flakiness signal is preserved. Normal runs
use `--dist=loadfile` (one file -> one worker -> one cluster) and never call this,
so they are unaffected.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Related: #105171
Under integration
flakyandtargetedchecks, pytest is launched with--dist=each, which spawns N xdist workers (typically 12 on the CI runner) each running its own isolated Docker cluster with a fresh PySpark JVM. With the three delta-lakeget_sparkbuilders previously pinningspark.driver.memoryandspark.executor.memoryto8g(16 GiB heap per worker), 12 workers × 16 GiB plus ASan/UBSan overhead in the ClickHouse processes themselves saturates host memory and the kernel kills the JVMs, after which every subsequent Spark call fromgenerate_datafails (spark._sc._jvmAttributeError) and the runner records anOOM in dmesgsynthetic failure.That is what happened on PR #105171's flaky check (https://github.com/ClickHouse/ClickHouse/actions/runs/26987765500/job/79643750220): 19
test_storage_delta/*failures all sharing the dead-JVM signature plus the syntheticOOM in dmesg.The data the tests feed Spark is tiny (
generate_datacalls top out atspark.range(0, 1300), most use 100 rows or fewer). 4 GiB total per JVM (2gdriver +2gexecutor) leaves comfortable headroom above the 1g/1g Spark default while making 12-worker--dist=eachfit (12 × 4 GiB = 48 GiB, well under the ~256 GiB host).Applied symmetrically to all three delta-lake test files that share the 8g/8g pattern -
tests/integration/test_storage_delta/test.py,tests/integration/test_storage_delta/test_cdf.py,tests/integration/test_storage_delta_disks/test.py- so the same OOM does not surface on any future PR touching a sibling file.test_storage_iceberg/test.pyandtest_storage_iceberg_disks/test.pyalready use Spark defaults and do not need a similar change.The previous 8g/8g value was added in
0302eb0c3af(2025-08-29, "Try fix spark out of memory") to address per-process OOM on a different path; 2g/2g still gives 4× the Spark default, preserving that intent while removing the multi-process pressure.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Version info
26.6.1.497