Repository navigation
Fix timeout in test_check_database_unity by batching Spark queries - #102649
Merged
Merged
Conversation
Combine schema creation, table creation, and insert queries into a single `execute_multiple_spark_queries` call to avoid multiple slow JVM startups that caused the test to time out. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Contributor
|
Workflow [PR], commit [3d1b435] Summary: ✅ AI ReviewSummaryThis PR updates ClickHouse Rules
Final Verdict
|
antonio2368
force-pushed
the
fix-database-delta-unity-timeout
branch
from
April 14, 2026 11:04
737d7b4 to
3d1b435
Compare
1 task
pull Bot
pushed a commit
to infdahai/ClickHouse
that referenced
this pull request
May 14, 2026
The chronic flaky test `test_database_delta::test_check_database_unity` times out on `Integration tests (arm_binary, distributed plan, 4/4)` when the Spark JVM hangs between metastore initialization and actual query execution. PR ClickHouse#102649 (merged 2026-04-14) batched 7 sequential Spark invocations into one, dropping the failure rate to 2 master hits in 30 days, but a residual hang remains and we currently have no data to localize it: on `subprocess.TimeoutExpired` the Spark JVM is killed by SIGKILL, so `stdout`/`stderr` are truncated to whatever Spark logged before the hang point and the existing `uc.log` tail is not enough to say where the JVM is stuck. Add a `_capture_spark_hang_diagnostics` helper that runs after the existing log capture in the exception handler of `execute_spark_query` and collects three pieces of state from inside the test container: 1. `jstack` thread dump of every running `org.apache.spark` JVM — shows exactly where the JVM is stuck during the hang. 2. Unity Catalog HTTP liveness probe on `http://localhost:8080` — shows whether UC is responsive while Spark is hung. 3. `ss -tnp` snapshot of sockets matching `:8080` or `java` — shows whether Spark holds open sockets to UC at the moment of the hang. Each diagnostic is wrapped in its own `try`/`except` so a failure in one does not prevent collection of the others, and all `exec_in_container` calls use a short timeout (15-30 s) so the diagnostics cannot extend the test failure time noticeably. The helper runs only on the already-failing path so it cannot make a passing test fail. This is diagnostic-only — it does not fix the residual hang. The data it captures will let the next master hit be localized to a specific stuck thread or UC RPC instead of "Spark stopped logging". Tracked in worker task 2026-05-12-ci-p2-testdatabasedeltatestcheckd.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix timeout in
test_check_database_unityby combining schema creation, table creation,and insert queries into a single
execute_multiple_spark_queriescall instead ofmultiple
execute_spark_querycalls. Each call starts a new JVM, and the cumulativestartup time was causing the test to exceed the timeout.
Master CI failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=66a2a0e7f28b36ec3f9da7f3b0b67e6926a67b8e&name_0=MasterCI&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20db%20disk%2C%20old%20analyzer%2C%202%2F6%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.4.1.927