Skip to content

Fix TSAN lock-order-inversion in nested JSON prefix deserialization - #107794

Merged
Avogar merged 7 commits into
ClickHouse:masterfrom
groeneai:groeneai/fix-107776-nested-json-prefixes-pool-tsan
Jun 25, 2026
Merged

Avogar merged 7 commits into
ClickHouse:masterfrom
groeneai:groeneai/fix-107776-nested-json-prefixes-pool-tsan

Conversation

@groeneai

@groeneai groeneai commented Jun 17, 2026 •

Copy link
Copy Markdown
Collaborator

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

Not required.

Description

Closes: #107776

ThreadSanitizer reported a lock-order-inversion (potential deadlock), STID 5654-6326, in SerializationObject::deserializeBinaryBulkStatePrefix.

CI report (Stress test (arm_tsan)): https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=107754&sha=67e40e52a110e6688b33af1371400f77fe8f7f5e&name_0=PR&name_1=Stress%20test%20%28arm_tsan%29

WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock)
  Cycle in lock order graph: M0 => M1 => M0
  #4 DB::SerializationObject::deserializeBinaryBulkStatePrefix(...)::$_1::operator()(SubstreamPath const&) const
     src/DataTypes/Serializations/SerializationObject.cpp:533

Root cause. The parallel branch wraps the non-thread-safe stream callbacks in safe_* lambdas guarded by a stack-local callbacks_mutex, then splits dynamic-path prefix deserialization across prefixes_deserialization_thread_pool. A nested JSON-in-JSON level re-entered the parallel branch, built a second callbacks_mutex, and re-wrapped the outer level's already-safe getter, holding the inner mutex across the re-entrant callback. M0 and M1 are these two stack-local mutexes; their addresses are recycled across independent deserialization trees, so TSAN's address-keyed lock-order graph saw the pair locked in both orders and reported a cycle. The getter-wrapping chain is monotonic on any live pair of instances, so a real cycle cannot form: the report is a false positive, but it recurs as ongoing stress-test noise (6 distinct PRs in 30 days, 0 on master).

Fix. Add an internal deserialize-settings flag prefix_deserialization_callbacks_are_thread_safe. The top level wraps the callbacks once under its callbacks_mutex and sets the flag in each per-task settings_copy. A nested level sees the flag set, still takes the parallel branch (nested parallelism is preserved), but reuses the ancestor's already-thread-safe callbacks instead of wrapping them under a second mutex. Only one callbacks_mutex is ever installed down the tree, so the lock-order-inversion pair cannot form. The flag is per-deserialization (not global), so independent deserialization trees do not interfere.

Verified locally on a debug build: with the flag fix a nested Array(JSON) full-column read still enters the parallel pool branch at the nested level but installs no second mutex, while reverting the flag re-creates the second mutex (the inversion source). Pool on vs off returns bit-identical results on a Wide-part nested-JSON column. Added a regression test (04357_json_nested_prefixes_deserialization_pool).

Version info

  • Merged into: 26.7.1.64 (included in 26.7 and later)
  • Backported to: 26.6.7.11

…r-inversion

SerializationObject::deserializeBinaryBulkStatePrefix wraps the non-thread-safe
stream callbacks in safe_* lambdas guarded by a stack-local callbacks_mutex, then
splits dynamic-path prefix deserialization across prefixes_deserialization_thread_pool.
The per-task settings_copy reused the same pool pointer, so a nested JSON-in-JSON
level re-entered the parallel branch, built a second callbacks_mutex, and re-wrapped
the outer level's already-safe getter, holding the inner mutex across the re-entrant
callback. The stack-local mutex addresses are recycled across independent
deserialization trees, so TSAN's address-keyed lock-order graph saw the pair locked
in both orders and reported a lock-order-inversion (potential deadlock). The
getter-wrapping chain is monotonic on any live pair of instances, so a real cycle
cannot form; the warning is a false positive but recurs as ongoing stress-test noise.

Null the pool in the per-task settings_copy so nested Object levels take the
sequential branch (no second callbacks_mutex, no re-wrapping). Top-level parallelism,
the S3 read win, is preserved.

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

Copy link
Copy Markdown
Collaborator Author

Pre-PR validation gate

# Question Answer
a Deterministic repro? The mechanism is deterministic: a Wide-part nested JSON-in-JSON column with merge_tree_use_prefixes_deserialization_thread_pool=1 (default) always takes the recursive parallel branch, building a second callbacks_mutex at the nested level. The TSAN warning itself is probabilistic (depends on stack-address recycling across deserialization trees), so it cannot be asserted in a functional test; the lock pair it flags is removed structurally instead.
b Root cause explained? The per-task settings_copy copied the pool pointer unchanged, so a nested Object level re-entered the parallel branch and created a second stack-local callbacks_mutex, re-wrapping the outer level's already-safe getter and holding the inner mutex across the re-entrant settings.getter callback. The two mutexes' addresses recycle across independent deserialization trees, so TSAN's address-keyed lock-order graph observed (M0,M1) in both orders and reported a cycle. The wrapping chain is monotonic on any live pair, so a real cycle cannot form: false positive.
c Fix matches root cause? Yes. Nulling settings_copy.prefixes_deserialization_thread_pool makes nested levels take the sequential branch, which has no callbacks_mutex and does no re-wrapping. This removes the second mutex (the root cause), not a symptom. It is not a defensive guard or a suppression.
d Test intent preserved / new tests added? No existing test weakened. Added regression test 04357_json_nested_prefixes_deserialization_pool exercising a Wide-part nested JSON-in-JSON read through the pool.
e Both directions demonstrated? The reported lock pair exists only while the nested pool is active; the fix removes it by construction (callbacks_mutex exists only in the parallel branch, grep-confirmed). Correctness shown equivalent both directions: pool on vs off returns bit-identical results (the four nested sums plus a full-row content hash matched exactly). All non-Replicated nested-JSON Wide-part tests pass; the new test is 30/30 under randomization.
f Fix is general, not a narrow patch? Yes. The single change covers all six safe_* callbacks (they share the one callbacks_mutex) and all nesting depths greater than one (every nested level now sequential). It fixes the re-entrancy at its source rather than guarding the symptom.

Session id: cron:clickhouse-worker-slot-3:20260617-205300

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @Avogar — could you review this? It nulls prefixes_deserialization_thread_pool in the per-task settings copy so nested JSON-in-JSON levels deserialize sequentially, removing the second stack-local callbacks_mutex that TSAN flags as a lock-order-inversion (STID 5654-6326). Top-level parallelism is preserved; nested-level parallelism is the trade-off, so your call on whether that is acceptable.

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

clickhouse-gh Bot commented Jun 17, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [d4a82a0]

Summary: ✅


AI Review

Summary

The code now keeps nested JSON prefix deserialization parallel and avoids the TSAN lock-order pair by propagating prefix_deserialization_callbacks_are_thread_safe, so nested SerializationObject levels reuse the ancestor's mutex-protected callbacks instead of wrapping them again. I did not find a new code-level blocker in the current diff, but the PR metadata still describes the superseded sequential implementation.

PR Metadata
  • 💡 The Changelog category is appropriate: CI Fix or Improvement fits a recurring TSAN false-positive CI failure, and the selected category does not require a changelog entry.
  • ⚠️ The active close line should use the required full URL form. Replace Closes: #107776 with Closes: https://github.com/ClickHouse/ClickHouse/issues/107776 outside the HTML comment.
  • ⚠️ The title and description still say the fix makes nested JSON prefixes deserialize sequentially / nulls prefixes_deserialization_thread_pool, but the current implementation deliberately preserves nested parallelism. Suggested title: Reuse thread-safe JSON prefix callbacks to avoid TSAN lock-order-inversion. Suggested replacement for the fix paragraph: "Keep the prefix pool for nested Object levels. The top-level parallel branch wraps the stream callbacks under one callbacks_mutex and sets prefix_deserialization_callbacks_are_thread_safe in each task copy; nested levels reuse those callbacks instead of wrapping again, so no second mutex is locked while nested prefix deserialization stays parallel."
Final Verdict

Status: ⚠️ Request changes

Minimum required actions: update the PR title/body to describe the flag-based callback reuse, and replace the active issue-closing line with the full issue URL. No code changes requested.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jun 17, 2026
…l-safe

The Style check (various_checks.sh) requires any stateless test issuing a
SYSTEM DROP* to carry the no-parallel tag, because SYSTEM DROP affects
server-wide shared state. Mark-cache warmth does not influence whether the
prefix-deserialization pool path is taken (that branch is gated only by
merge_tree_use_prefixes_deserialization_thread_pool plus a Wide part with
dynamic paths, and the prefix state is deserialized fresh on each read setup).
Drop the SYSTEM DROP MARK CACHE line so the test needs no no-parallel tag and
stays parallel-safe. Output and the guarded code path are unchanged.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
The previous test inserted a plain nested object, which JSON flattens into
scalar dynamic paths (nested.x, nested.y.deep, nested.y.deeper). The prefix
pool tasks then only deserialize scalar dynamic paths and never recurse into a
nested SerializationObject, so the test did not exercise the changed invariant
and passed even with the production fix reverted.

Make the 'arr' path an array of objects so JSON stores it as a dynamic path of
type Array(JSON), i.e. a genuine nested SerializationObject. Reading subcolumns
of the array elements drives a prefix-deserialization pool task to recurse into
the nested object's prefix. Verified locally on a debug build by instrumenting
the parallel-pool branch: with the fix reverted the branch is entered for the
nested level too (the re-entrant path that creates the second callbacks_mutex);
with the fix it is entered only for the top level. Pool=1 and pool=0 reads give
bit-identical results.

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

Copy link
Copy Markdown
Collaborator Author

Pre-PR validation gate (test reshape, 4a3e0f8)

# Question Answer
a Deterministic repro? Yes. Instrumenting the if (prefixes_deserialization_thread_pool && ...) branch in SerializationObject::deserializeBinaryBulkStatePrefix deterministically shows: with the fix reverted, the branch is entered for the nested Array(JSON) level (path {..., VariantElement(Array(JSON...)), ArrayElements, ObjectData}); with the fix, only the top level enters it. The old test data shape never entered the nested branch.
b Root cause explained? The original test inserted a plain nested object; JSON flattens it to scalar dynamic paths (nested.x, nested.y.deep), so pool tasks only deserialize scalar paths and never recurse into a nested SerializationObject. The fix only changes behavior on that nested re-entry, so the test passed even with the fix reverted (the bot's finding).
c Fix matches root cause? Yes. The data now has an arr array-of-objects, stored as a dynamic path of type Array(JSON) (a real nested SerializationObject), and the test reads its element subcolumns, forcing a pool task to recurse into the nested prefix - the exact path the production change guards.
d Test intent preserved / new tests added? Same test, now actually exercising the guarded path. Still asserts the Wide-part count, the Array(JSON) dynamic type, the nested dynamic paths, and nested-field sums. No production code changed.
e Both directions demonstrated? At the production-behavior level: fix reverted -> nested parallel branch entered (the re-entrant second callbacks_mutex source); fix applied -> nested level takes the sequential branch. This is a TSAN false-positive fix, so debug query results are identical either way; the distinguishing signal is which branch the nested level takes, which the reshaped test now drives and the old one did not. pool=1 and pool=0 reads are bit-identical.
f Fix is general, not a narrow patch? N/A - this commit only reshapes the regression test; the production fix is unchanged. The fix targets the single re-entrant site in deserializeBinaryBulkStatePrefix (the only place the pool is re-passed into a nested level).

Verified locally on a debug build (clang-21), 50/50 passes with randomized settings via clickhouse-test.

Session id: cron:clickhouse-worker-slot-3:20260617-234300

…ntry

A subcolumn read of an Array(JSON) path goes through SerializationObjectDynamicPath
and reaches the nested object as a standalone pool owner, so it never enters the outer
SerializationObject::deserializeBinaryBulkStatePrefix pool task where the fix nulls the
per-task pool pointer. Only a full-column read makes the outer object's pool task recurse
into the nested object's prefix, which is the re-entrant path this PR changes.

Replace the subcolumn-only assertions with a full-column read (SELECT data WHERE id = 5)
plus a whole-column read across all granules. Verified by instrumenting the pool branch on
a debug build: with the fix reverted the full-column read enters the pool branch twice
(top-level depth 1 and nested depth 7), and with the fix only the top-level entry remains;
the subcolumn reads enter only the nested branch in both cases and so do not exercise the
change. Results are bit-identical between pool=1 and pool=0.

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

Copy link
Copy Markdown
Collaborator Author

Pre-PR validation gate (updated for the test reshape in c596639)

# Question Answer
a Deterministic repro? Yes. On a debug build with the production fix reverted, a full-column read (SELECT data FROM t WHERE id = 5) deterministically enters the pool branch at both depth=1 and nested depth=7 on every run; with the fix, only depth=1.
b Root cause explained? The outer SerializationObject::deserializeBinaryBulkStatePrefix pool task installs a stack-local callbacks_mutex and safe_getter, then deserializes the arr dynamic path whose type is Array(JSON). Without the fix the per-task settings_copy keeps the pool pointer, so that nested Object re-enters the pool branch and builds a second callbacks_mutex, re-wrapping the already-safe getter. TSAN conflates the recycled stack-mutex addresses across deserialization trees into a lock-order-inversion.
c Fix matches root cause? Yes. The fix nulls settings_copy.prefixes_deserialization_thread_pool in the per-task lambda so nested levels take the sequential branch (no second mutex). This is the existing PR change, unchanged by this commit.
d Test intent preserved / new tests added? This commit corrects the regression test so it actually exercises the changed path. The prior version read only data.arr subcolumns, which reach the nested object via SerializationObjectDynamicPath as a standalone pool owner and never enter the outer pool task. The test now reads the whole data column, which is the only shape that triggers the re-entry.
e Both directions demonstrated? Yes. Pool-branch instrumentation: fix reverted -> full-column read enters nested depth=7 (re-entry present); fix applied -> nested entry gone. Subcolumn reads are unchanged in both directions, confirming the prior test could not fail. pool=1 vs pool=0 reads are bit-identical; 50/50 passes with randomization on (debug, clang-21).
f Fix is general, not a narrow patch? The production fix targets the single re-entrant code path in SerializationObject::deserializeBinaryBulkStatePrefix; nested Object levels at any depth take the sequential branch. No sibling path duplicates this pool re-entry. This commit is test-only.

Session id: cron:clickhouse-worker-slot-6:20260618-011000

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finished on HEAD c596639793a7. The one red check is a known infra flake, not a fuzzer finding:

  • BuzzHouse (amd_debug): job error FileNotFoundError: ci/tmp/workspace/status.tsv (the runner aborted before writing status.tsv; no STID, no crash stack, no ClickHouse frame). The other 3 BuzzHouse builds (amd_tsan, amd_msan, arm_asan_ubsan) passed on this exact SHA. Chronic harness flake tracked separately; a re-run clears the Mergeable Check.

Functional and style checks are green; the reshaped Array(JSON) full-column-read regression test passes.

@Avogar Avogar self-assigned this Jun 18, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

@alexey-milovidov Investigated. The BuzzHouse (amd_debug) red on c596639793a7 is the chronic harness teardown flake, not a fuzzer finding and not caused by this PR.

What the artifacts show:

  • The check is check_status=error with no test row. The only error is FileNotFoundError: ci/tmp/workspace/status.tsv at ci/jobs/ast_fuzzer_job.py:240: the runner aborted before it wrote status.tsv.
  • server.log: clean graceful shutdown (Received signal -2, SIGINT from stop_server). No <Fatal>, no Logical error, no sanitizer report, no crash. This PR's serialization change does not appear anywhere in the server log.
  • fuzzer.log: only normal client-side query rejections (Received from localhost:9000, server alive and rejecting fuzzed SQL). It ends with an injected fault point (Code 241 tcp_handler_fail_connection_setup), not a "Fuzzer found a problem".
  • The other 3 BuzzHouse builds (amd_tsan, amd_msan, arm_asan_ubsan) passed on this exact SHA.

It is chronic, independent of this PR: the same status.tsv FileNotFoundError hit 40 distinct PRs plus 5 master rows in 14 days on amd_debug alone, and 26 to 44 distinct PRs across all 4 BuzzHouse builds in 7 days.

The opaque FileNotFoundError is exactly what #107676 makes transparent (report the runner abort instead). A BuzzHouse re-run clears the Mergeable Check.

Session: cron:clickhouse-worker-slot-1:20260620-161300

@alexey-milovidov alexey-milovidov self-assigned this Jun 22, 2026
@alexey-milovidov

Copy link
Copy Markdown
Member

@groeneai, update the branch here, so we will have a chance to merge.

@groeneai

Copy link
Copy Markdown
Collaborator Author

@alexey-milovidov branch updated: merged current master (7ef8534) into groeneai/fix-107776-nested-json-prefixes-pool-tsan, now 0 behind. Clean merge, no conflicts (SerializationObject.cpp had no master drift; the two test files are new). New HEAD 09a629a; fresh CI is running. Net diff vs master is unchanged: the prefixes_deserialization_thread_pool = nullptr fix plus the Array(JSON) full-column-read regression test.

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finished on 09a629afdc7a (branch updated with current master). The red checks are not introduced by this PR:

  • Integration tests (amd_tsan, 3/6) test_executable_udf_profile_events::test_peak_memory_is_max_not_sum: flaky assertion, 10 unrelated PRs / 30d.
  • Integration tests (amd_asan_ubsan, ... 4/6) Timeout: runner session-timeout.
    The reshaped Array(JSON) full-column-read regression test passes; the bot review thread is resolved.

/// A nested Object level must deserialize sequentially: re-entering the pool here would
/// create a second callbacks_mutex and re-wrap the already-safe getter, which TSAN flags
/// as a lock-order-inversion across recycled stack-mutex addresses.
settings_copy.prefixes_deserialization_thread_pool = nullptr;

@Avogar Avogar Jun 23, 2026 •

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.

It's a bad fix, it will lead to performance degradation on cases with wide nested JSONs, especiall when top level JSON contains a few Array(JSON) keys. We should not disable parallel prefixes deserialization for nested objects. Let's think about other solution.

@Avogar Avogar Jun 23, 2026 •

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.

Maybe we can add a bool flag to settings that the getters are safe and don't recreate them in nested deserializations?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done, in 1c74eac. Added a prefix_deserialization_callbacks_are_thread_safe flag to the deserialize settings. The top-level parallel branch wraps the callbacks under its callbacks_mutex and sets the flag in each task's settings_copy; a nested level sees the flag, keeps the pool (still takes the parallel branch, so nested parallelism is preserved), and reuses the ancestor's already-safe callbacks instead of installing its own wrappers. The nested callbacks_mutex is thus never locked, so only the single top-level mutex is acquired down the whole tree and the lock-order pair TSAN reported cannot form. No parallelism is disabled for wide/multi-Array(JSON) nested objects. The flag defaults to false, so other callers are unchanged.

Verified on a debug build via instrumentation at the parallel-branch entry, reading the full data column of an Array(JSON) path:

  • with the flag fix: top-level enters with wrap_callbacks=1; the nested Array(JSON) level (depth 7) still enters the parallel branch but with wrap_callbacks=0 (no second mutex installed).
  • with the flag forced off (old always-wrap behavior): the nested level enters with wrap_callbacks=1, installing and locking the second mutex (the LOI source).

pool=1 vs pool=0 reads are bit-identical; the 04357 regression test passes 15/15 with randomization on.

The previous fix nulled prefixes_deserialization_thread_pool in the per-task
settings_copy so nested JSON-in-JSON Object levels took the sequential branch.
That removed the second callbacks_mutex (the TSAN lock-order-inversion source)
but also disabled parallel prefix deserialization for nested objects, which
degrades wide nested JSONs, especially when the top-level JSON has several
Array(JSON) keys.

Instead, keep the pool for nested levels and add a flag,
prefix_deserialization_callbacks_are_thread_safe, to the deserialize settings.
The top-level parallel branch wraps the stream callbacks in safe_* lambdas under
its stack-local callbacks_mutex and sets the flag in each task's settings_copy.
A nested level sees the flag set, still enters the parallel branch (nested
parallelism preserved), but reuses the ancestor's already-safe callbacks instead
of installing its own wrappers. The nested callbacks_mutex is therefore never
locked, so only the single top-level mutex is ever acquired down the whole tree
and no lock-order edge between two nested-level mutexes can form. This removes
the TSAN potential-deadlock warning (recycled stack-mutex addresses conflated
across deserialization trees) without serializing nested deserialization.

The flag defaults to false, so all other callers are unchanged.
@groeneai

Copy link
Copy Markdown
Collaborator Author

Pre-PR validation gate

Updated for the flag-based redesign (commit 1c74eac, per the review on this thread).

# Question Answer
a Deterministic repro? Yes. Debug build, instrumentation at the if (prefixes_deserialization_thread_pool ...) parallel-branch entry logging substream depth + wrap_callbacks. Reading the full data column of an Array(JSON) path (SELECT data FROM t WHERE id=5) deterministically enters the branch at top-level (depth 1) and at the nested Array(JSON) level (depth 7).
b Root cause explained? Each parallel level wraps the non-thread-safe stream callbacks in safe_* lambdas guarded by a stack-local callbacks_mutex. The per-task settings_copy reused the pool pointer, so a nested JSON-in-JSON level re-entered the branch, built a second callbacks_mutex, and re-wrapped the outer level's already-safe getter, holding the inner mutex across the re-entrant call. The stack-mutex addresses are recycled across independent deserialization trees, so TSAN's address-keyed lock-order graph saw the pair locked in both orders and reported a lock-order-inversion.
c Fix matches root cause? Yes. The new prefix_deserialization_callbacks_are_thread_safe flag makes a nested level reuse the ancestor's already-safe callbacks instead of installing a second wrapper, so the nested callbacks_mutex is never locked and only one mutex is ever acquired down the tree. It does not null the pool, so nested parallel prefix deserialization is preserved (addresses the performance concern raised on the review).
d Test intent preserved / new tests added? Yes. The existing 04357 regression test (Array(JSON) full-column read that drives the nested re-entry) is kept unchanged and still exercises the path.
e Both directions demonstrated? Yes. With the flag fix the nested level enters the parallel branch with wrap_callbacks=0 (no second mutex). With the flag forced off (old always-wrap behavior) the nested level enters with wrap_callbacks=1, installing and locking the second mutex (the LOI source). pool=1 vs pool=0 reads bit-identical; 04357 passes 15/15 with randomization on.
f Fix is general, not a narrow patch? Yes. SerializationObject::deserializeBinaryBulkStatePrefix is the only place this re-entrant parallel prefix branch exists. The flag is an internal ISerialization::DeserializeBinaryBulkSettings field (not a Core setting), defaults to false, and leaves all other callers unchanged. The fix targets the re-wrapping at its source rather than guarding a symptom.

Session id: cron:clickhouse-worker-slot-4:20260623-150000

The fix now keeps nested prefix deserialization parallel and reuses the
ancestor's already thread-safe callbacks via
settings.prefix_deserialization_callbacks_are_thread_safe, instead of
forcing the nested level onto a sequential branch. Correct the test
comment, which still described the old sequential approach.

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

clickhouse-gh Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 85.30% 85.40% +0.10%
Functions 92.50% 92.60% +0.10%
Branches 77.60% 77.60% +0.00%

Changed lines: Changed C/C++ lines covered by tests: 19/19 (100.00%) | Lost baseline coverage: none · Uncovered code

Full report · Diff report

@Avogar Avogar 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.

Let's change the PR title now

@groeneai groeneai changed the title Deserialize nested JSON prefixes sequentially to avoid TSAN lock-order-inversion Fix TSAN lock-order-inversion in nested JSON prefix deserialization Jun 24, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

Retitled to "Fix TSAN lock-order-inversion in nested JSON prefix deserialization". The old title said "sequentially", which described the first approach; the merged fix keeps nested prefix deserialization parallel and only avoids the second callbacks mutex via prefix_deserialization_callbacks_are_thread_safe. Synced the PR description to match. No code change, HEAD stays d4a82a0.

@Avogar
Avogar added this pull request to the merge queue Jun 25, 2026
Merged via the queue into ClickHouse:master with commit c8fecad Jun 25, 2026
167 checks passed
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jun 25, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…6-nested-json-prefixes-pool-tsan

Fix TSAN lock-order-inversion in nested JSON prefix deserialization
@PedroTadim

Copy link
Copy Markdown
Member

Need to backport to fix CI in 26.6

@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Sep 14, 2026
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Sep 14, 2026
clickhouse-gh Bot pushed a commit that referenced this pull request Sep 14, 2026
clickhouse-gh Bot added a commit that referenced this pull request Sep 14, 2026
Backport #107794 to 26.6: Fix TSAN lock-order-inversion in nested JSON prefix deserialization
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-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-ci pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR pr-synced-to-cloud The PR is synced to the cloud repo v26.6-must-backport

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ThreadSanitizer: potential deadlock (STID: 5654-6326)

6 participants