Repository navigation
Fix three librdkafka data races that abort amd_tsan Kafka tests - #129623
Conversation
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 #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]>
|
Workflow [PR], commit [597cade] Summary: ✅
AI ReviewSummaryPR #129623 updates Final VerdictStatus: ✅ Approve |
ClickHouse/librdkafka#23 and ClickHouse/librdkafka#24 are now merged into `ClickHouse/v2.15.1`, together with ClickHouse/librdkafka#26, which stops `rd_kafka_app_polled` from touching `rk_cgrp` on the application thread (a third TSan race, against `rd_kafka_cgrp_handle_ConsumerGroupHeartbeat`). Use the branch head instead of the temporary `ClickHouse/v2.15.1-toppar-races`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
librdkafka toppar data races that abort amd_tsan Kafka testslibrdkafka data races that abort amd_tsan Kafka tests
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units69 translation units recompiled, 18 s compile time in total, 69 of them have a recent master baseline. Median compile-time ratio to the baselines is ×0.95 (machine-speed difference or a change affecting every TU); per-TU deltas below are relative to that ratio. |
|
🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=129623&sha=450352d7f9eda943fc6a4336356bbf4a89ab28c8&name_0=PR&name_1=La%20Casa%20Del%20Dolor%20%28amd_tsan%29 and provide a fix in a separate PR. If the fix is already in progress, link it here. The TSan report is a data race in |
|
This is the race fixed by #114995, so I'm not opening a separate PR. Both sides of the report are #114995 removes it: |
Data races inside
librdkafkamake ThreadSanitizer abort the server inIntegration tests (amd_tsan, 7/8). When that happens, a wholetest_storage_kafkamodule fails (49 tests at once intest_batch_fast.pyon 2026-11-05). This happened in 6 master runs since 2026-11-02.This bumps
contrib/librdkafkato the head of the fork branchClickHouse/v2.15.1(7e72f589), which adds three merged fork PRs:rd_kafka_toppar_handle_Offsetreadrktp_op_versionwithout the toppar lock when the callback runs on a broker thread (the__DESTROYpath). This racedrd_kafka_toppar_op_version_bump. It now snapshots the version inside the critical section the function already takes.rd_kafka_toppar_fetch_backoffwroterktp_ts_fetch_backofffrom broker threads without the toppar lock. This racedrd_kafka_toppar_set_fetch_state. It now takes the lock. The two callers inrd_kafka_toppar_fetch_decidealready hold the lock, so they call the newrd_kafka_toppar_fetch_backoff0instead. None of the four remaining callers of the locking wrapper holds the lock. The body already ran under this lock fromrd_kafka_toppar_fetch_decide, so no new lock-order edge is introduced.rd_kafka_app_polledno longer touchesrk_cgrpon the application thread. That access racedrd_kafka_cgrp_handle_ConsumerGroupHeartbeatintest_storage_kafka_sasl/test.py::test_kafka_kip848_consumer_group_protocol. The main thread resumes heartbeats once it sees the updatedrk_ts_last_poll.This replaces the ignore-list approach of #128742. Upstream
confluentinc/librdkafkamaster still has the toppar races. The 2.16.0 bump (#128315, fork branchClickHouse/v2.16.0) needs the same commits.Reports:
Related: #128742
Related: ClickHouse/librdkafka#23
Related: ClickHouse/librdkafka#24
Related: ClickHouse/librdkafka#26
Changelog category (leave one):
🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/129623]
Version info
26.11.1.1629-master(included in26.11and later)