Skip to content

Backport #99366 to 25.8: Fix data race between BackgroundJobsAssignee::start and finish - #114295

Merged
alexey-milovidov merged 7 commits into
25.8from
backport/25.8/99366
Aug 19, 2026
Merged

alexey-milovidov merged 7 commits into
25.8from
backport/25.8/99366

Conversation

@robot-clickhouse-ci-1

@robot-clickhouse-ci-1 robot-clickhouse-ci-1 commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Original pull-request #99366

This pull-request is a last step of an automated backporting.
Treat it as a standard pull-request: look at the checks and resolve conflicts.
Merge it only if you intend to backport changes to the target branch, otherwise just close it.

The PR source

The PR is created in the CI job

Version info

  • Merged into: 25.8.31.10

@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-backport Changes, backported to release branch. Do not use manually - automated use only! label Aug 11, 2026
@clickhouse-gh

clickhouse-gh Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [BackportPR], commit [a9c176e]

@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 The only failing check, Integration tests (amd_asan, old analyzer, 2/6) ->
test_storage_s3_queue/test_parallel_inserts.py::test_batch_set_processing_failure_does_not_crash,
is unrelated to this backport: it touches only BackgroundJobsAssignee::finish on the MergeTree
side, while the failing test exercises S3Queue.

It is the known 25.8-only flakiness of that test, diagnosed in
#113728. On 25.8 the processing-node directory is
chosen at runtime from use_persistent_processing_nodes, which the shared test helper randomizes,
so the Keeper conflict node the test plants under {keeper_path}/processing/ is inert on about half
the draws and ObjectStorageQueueFailedToBatchSetProcessing never rises. The failing run here drew
the losing value - its DDL reads use_persistent_processing_nodes=True - and ended with
1 did not match expectations in 120 retries, the documented signature. master and the 26.x
branches are green because the directory is the compile-time literal "processing" there.

The fix for it (pinning that setting in the test) was closed at a maintainer's request to leave the
25.8 branch alone for now, so there is nothing to pull in from the base branch. I merged 25.8
into this branch to refresh it and re-run CI, which re-rolls that coin flip.

@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Merged origin/25.8 again (10 commits behind) to trigger a fresh CI run. Both reds on commit 55e535f8 are unrelated flakes:

Related: #85011

@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Fresh CI on c5c8d19761f1 (after the 25.8 merge): the previous test_ttl_move flake cleared, and the only remaining red is again Integration tests (amd_tsan, 4/6) -> test_storage_s3_queue/test_parallel_inserts.py::test_batch_set_processing_failure_does_not_crash (1 of 548), with the same documented signature: the DDL of the failing run has use_persistent_processing_nodes=True (the losing draw) and it ends with 1 did not match expectations in 120 retries.

This is the known 25.8-only flakiness described in my comment above; its test-only fix #113728 was closed at a maintainer's request to leave the 25.8 branch alone, so there is nothing to pull in from the base branch and nothing to fix inside this backport. The branch is up to date with 25.8 and the backported change itself (BackgroundJobsAssignee::finish) is unrelated to S3Queue.

Merging remains a human decision, and in particular whether the 25.8 backport is wanted at all.

@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=114295&sha=c5c8d19761f10e151b8e8ba7a33ab68577e07e9b&name_0=BackportPR&name_1=Integration%20tests%20%28amd_tsan%2C%204%2F6%29 and provide a fix in a separate PR. The failing test_batch_set_processing_failure_does_not_crash is the known 25.8-only S3Queue flake described in #113728; its test-only fix was deliberately not backported.

@groeneai

Copy link
Copy Markdown
Collaborator

Confirmed independently at c5c8d19761f1, Integration tests (amd_tsan, 4/6): 1 failed / 530 passed, the failing table's DDL carries use_persistent_processing_nodes=True, and the run ends with 1 did not match expectations in 120 retries. Your diagnosis holds at code level: 25.8 derives the processing path from getProcessingNodesPath(use_persistent_processing_nodes_) where master uses the literal "processing", and helpers/s3_queue_common.py:125 randomizes the setting.

The fix is already written as a separate PR: #113728, 3 lines pinning use_persistent_processing_nodes = 0 in that test's additional_settings. It still applies cleanly to the 25.8 tip.

One thing I will not decide on my own: #113728 was closed on 2026-08-07 because @ PedroTadim asked me to stand down on 25.8 ("dont be concerned about the 25.8 branch for now"), and I withdrew the v25.8-must-backport request then. Your ask points the other way, so which should stand?

If it should land, I cannot hand-author a backport/25.8/... PR (that automation is label-driven). The route is to reopen #113728 against master and apply v25.8-must-backport to it. Say go and I will reopen and refresh it; the label is the only part I cannot do myself.

@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Rechecked the current red report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=114295&sha=1d70919cd51197f33f26a08aaccede0da2275b41&name_0=BackportPR&name_1=Integration%20tests%20%28amd_tsan%2C%202%2F6%29

It is the same test_storage_s3_queue/test_parallel_inserts.py::test_batch_set_processing_failure_does_not_crash failure (1 failed, 532 passed) previously diagnosed here: on 25.8, the test helper randomizes use_persistent_processing_nodes, while the test plants the conflict node only under processing/. This backport changes only BackgroundJobsAssignee::finish and cannot affect that path.

The deterministic test-only repair is already present in closed #113728, but a maintainer explicitly directed that 25.8 work stop: #113728 (comment). Therefore I have not mixed that unrelated change into this backport or reopened it; whether to resume the 25.8 test repair is a maintainer decision.

There are no review threads, review comments, or outstanding reviewer requests on this PR. The branch is mergeable and contains only src/Storages/MergeTree/BackgroundJobsAssignee.cpp changes.

@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Investigated the failed Stress test (amd_tsan) report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=114295&sha=c14be15efc2709d45c628e541be51bfca49434f9&name_0=BackportPR&name_1=Stress%20test%20%28amd_tsan%29

It is the exact Part ... remains in ZooKeeper after DROP_RANGE race tracked by #92850. That issue was closed after #96164, but its fix is not present in 25.8. The failure is in StorageReplicatedMergeTree::executeDropRange while the PR change is limited to BackgroundJobsAssignee::finish; this backport should not absorb the unrelated 70-line INSERT/DROP_RANGE fix without an explicit release-branch decision.

I requested a rerun of the failed job; it is currently queued. No unresolved review threads, review comments, or reviewer requests exist on this PR. A maintainer decision is needed on whether to backport #96164 to 25.8 in a separate PR.

@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Rechecked the refreshed base and current head c14be15efc27: the PR is already fully up to date with 25.8, remains mergeable, and all current BackportPR checks are successful. The previously discussed deterministic S3Queue test repair has since landed in 25.8 via #114761, so it no longer requires a release-branch decision. There are no unresolved review threads, review comments, or reviewer requests.

@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=114295&sha=fedec06cdf0b250f7b5b0882481e0df6f077be52&name_0=BackportPR&name_1=Stress%20test%20%28amd_tsan%29 and provide a fix in a separate PR if the 25.8 backport is approved. The failure is the known analyzer exception Unexpected return type from concat. Expected Nullable(String). Got String, tracked by #115177; the PR changes only BackgroundJobsAssignee::finish and is unrelated.

@groeneai

Copy link
Copy Markdown
Collaborator

Confirmed at fedec06cdf0b, Stress test (amd_tsan). fatal_messages.txt carries Logical error: 'Unexpected return type from concat. Expected Nullable(String). Got String.' exactly once, and the five other red rows (Server died, both Killed by signal, Found signal in gdb.log, hung check) are collateral of that single abort. The aborting query is SELECT t2.id || '_1' AS id, t1.val ..., which is query 2 of 03716_multiple_joins_using_top_level_identifier. Your read that this PR is unrelated holds: its diff is 12 lines in BackgroundJobsAssignee.cpp and touches none of the analyzer files involved.

Breadth over 30 days: every occurrence is 25.8 lineage, 13 commits on the branch's own CI plus five backport PRs (#115207, #114295, #112990, #112423, #112333). Zero on master, zero on 26.3/26.5/26.6/26.7.

The reason it is 25.8-only is that upstream shipped two changes for this and the branch has neither. #91128 (2025-12-01) muted the three queries with SETTINGS join_use_nulls = 0; #92251 (2025-12-19) fixed the analyzer nullability derivation, closed #92173, and replaced that mute with join_use_nulls = 1 variants. 25.8 received the test itself but neither change, so its copy has 0 occurrences of join_use_nulls. Stress sets join_use_nulls=1 deterministically (tests/ci/stress.py:48) and the setting is not in the stateless randomizer, which is why the plain suite is green on 25.8 and only stress aborts.

So there is no PR for me to open: per @ pufit's rule I do not hand-author backport/25.8/... branches, and you confirmed that route on #111910. The remedy is a label, and I asked for it on #112990 on 2026-08-03 (issuecomment-5166567231) with no reply yet.

Which label is your call, because the two differ in more than mechanics:

Separately, the S3Queue half of this thread is settled: your #114761 landed the deterministic repair on 25.8 and test_batch_set_processing_failure_does_not_crash is 23 OK / 0 FAIL across 11 commits of 25.8 lineage since. Nothing outstanding there.

@groeneai

Copy link
Copy Markdown
Collaborator

Confirmed on both counts: this PR touches only BackgroundJobsAssignee.cpp, and the abort is
25.8-lineage only. CIDB on the exact message, 180 days: 58 rows on head_ref = 25.8, 14 on
distinct 25.8-targeting backport PRs, 0 on master.

Cause is a backport gap. Two commits are missing from 25.8 and present on master and all four
26.x branches: #91128 (c96030144ed9) muted
03716_multiple_joins_using_top_level_identifier with join_use_nulls = 0, and #92251
(b3cf84f4f2b5) then fixed the analyzer and replaced that mute with join_use_nulls = 1
coverage. 25.8 runs the test unmuted and unfixed, a state master was never in. Not random:
tests/ci/stress.py:48 sets join_use_nulls=1 whenever i % 3 == 1, and the setting is not in
25.8's randomizer.

Verified on the official binaries, query 2 of that test: Code: 49 with the CI message
byte-identical on 25.8.31.5, rows returned on 26.8.1.1595. In IdentifierResolver.cpp, 25.8's
convert_resolved_result_type_if_needed resets a column that is already Nullable(String) from
the preceding LEFT JOIN to the String USING supertype; master re-applies nullability there.

I will not hand-author a release-branch PR, per your instruction on #111910, so this needs a
label from you. Your condition is also unmet so far: reviewDecision here is still empty.

Which target is your call:

Either expands to exactly one PR, against 25.8. I already asked for #91128 on #112990, so no new
ask is needed unless you prefer #92251, and I will drive whichever PR the label produces.

Also worth noting: #98630 is the same signature, assigned to @ vdimir, closed as completed on
2026-08-15 without a 25.8 fix landing.

@alexey-milovidov
alexey-milovidov merged commit c6b48ef into 25.8 Aug 19, 2026
33 checks passed
@alexey-milovidov
alexey-milovidov deleted the backport/25.8/99366 branch August 19, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backport Changes, backported to release branch. Do not use manually - automated use only!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants