Repository navigation
Conversation
The broker thread reads `rktp_op_version` in `rd_kafka_toppar_handle_Offset` and writes `rktp_ts_fetch_backoff` in `rd_kafka_toppar_fetch_backoff` without the toppar lock, while the `librdkafka` main thread writes them under the lock. TSan reports kill the server for the whole `test_storage_kafka` module on `amd_tsan`.
Contributor
|
Workflow [PR], commit [86fc978] Summary: ✅ AI ReviewSummaryReviewed PR #128742 at Missing context / blind spots
Final Verdict✅ Approve. No code changes requested; normal CI validation remains pending. |
alexey-milovidov
requested changes
Nov 5, 2026
alexey-milovidov
left a comment
Member
There was a problem hiding this comment.
We shouldn't have any suppressions.
| # `unixRandomness` without synchronization. SQLite documents the race as harmless right at the | ||
| # access ("two or more threads all trying to open databases at the same instant might all reset | ||
| # the PRNG. But multiple resets are harmless."), and the writer in `unixRandomness` runs under | ||
| # SQLite's own PRNG mutex, which the reader in `unixOpen` does not take. Two concurrent SQLite |
Member
There was a problem hiding this comment.
This is also bad. We should patch sqlite instead.
huldarchen
pushed a commit
to huldarchen/ClickHouse
that referenced
this pull request
Nov 7, 2026
Bump `contrib/librdkafka` to `ClickHouse/v2.15.1-toppar-races`, which is `ClickHouse/v2.15.1` plus ClickHouse/librdkafka#23 and ClickHouse/librdkafka#24: - `rd_kafka_toppar_handle_Offset` read `rktp_op_version` without the toppar lock when the callback runs on a broker thread (the `__DESTROY` path), racing `rd_kafka_toppar_op_version_bump`. It now snapshots the version inside the critical section it already takes. - `rd_kafka_toppar_fetch_backoff` wrote `rktp_ts_fetch_backoff` from broker threads without the toppar lock, racing `rd_kafka_toppar_set_fetch_state`. It now takes the lock; the callers in `rd_kafka_toppar_fetch_decide`, which already hold it, use the new `rd_kafka_toppar_fetch_backoff0`. The TSan reports kill the server, failing whole `test_storage_kafka` modules in `Integration tests (amd_tsan, 7/8)`: 6 master runs since 2026-11-02. This replaces the ignore-list approach of ClickHouse#128742. Report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=bfafa10aac621acb9fde1bdee67d667a132ea000&name_0=MasterCI&name_1=Integration%20tests%20%28amd_tsan%2C%207%2F8%29 Report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=5c48e43bc4f46af85f720a03edf7b100367b7ba6&name_0=MasterCI&name_1=Integration%20tests%20%28amd_tsan%2C%207%2F8%29 Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
TSan reports data races inside
librdkafkaintest_storage_kafkaonamd_tsan. The server dies and the whole module fails, most often intest_multi_consumer_quota.py::test_temporary_lock_quota_is_retained_across_rounds. Public CIDB over the last 60 days has 11 such reports, in two families:test_temporary_lock_quota_is_retained_across_roundson 2026-10-21, 2026-10-25, 2026-10-26 and twice on 2026-10-27,test_kafka2_dead_letter_queue_commit_on_selecton 2026-09-07). The write is inrd_kafka_toppar_op_version_bump, called fromrd_kafka_toppar_pause_resumeorrd_kafka_toppar_fetch_stopon thelibrdkafkamain thread under the toppar lock. The read is inrd_kafka_toppar_handle_Offset, called fromrd_kafka_broker_bufq_timeout_scanon a broker thread, which readsrktp_op_versionwithout the lock.test_kafka_consumers_with_assignment_after_rebalanceon 2026-10-23 and 2026-10-27,test_kafka_rebalanceon 2026-10-29).rd_kafka_toppar_set_fetch_state(main thread, under the lock) andrd_kafka_toppar_fetch_backoff(broker thread, fromrd_kafka_fetch_reply_handle_partition_error, no lock) both writerktp_ts_fetch_backoff.Both accesses in each pair run on
librdkafka's own threads. ClickHouse code shows up only in the allocation stack of the toppar (KafkaConsumer2::initializeQueues->cppkafka::Consumer::get_partition_queue). Add the unlocked side of each pair totests/tsan_ignorelist.txt, next to the existingrd_kafka_broker_set_nodenameentry (#55629). Both functions arestaticand are not inlined at these call sites (they have their own frames in the reports), so they use the*name*form. Ignoring one side of a pair is enough because TSan reports a race only against a recorded access.A third family,
rd_kafka_app_polledvsrd_kafka_cgrp_handle_ConsumerGroupHeartbeat(2 reports intest_storage_kafka_sasl/test.py::test_kafka_kip848_consumer_group_protocol, both from #127757), is left alone: the heartbeat handler is large, and ignoring it would hide too much.Changelog category (leave one):
Workflow [PR]
Sync PR [sync-upstream/pr/128742]