Skip to content

Fix data race on pmull_runtime_flag in crc32c - #29

Merged
alexey-milovidov merged 1 commit into
ClickHouse/v10.10.fbfrom
ClickHouse/fix-tsan-crc32c
Apr 10, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse/v10.10.fbfrom
ClickHouse/fix-tsan-crc32c

Conversation

@alexey-milovidov

Copy link
Copy Markdown
Member

The global bool pmull_runtime_flag is written from IsFastCrc32Supported and Choose_Extend without synchronization, causing a TSan report when multiple RocksDB instances are opened concurrently. Make it std::atomic<bool> with relaxed ordering, since it is always set to the same value.

The global `bool pmull_runtime_flag` is written from `IsFastCrc32Supported`
and `Choose_Extend` without synchronization, causing a TSan report when
multiple RocksDB instances are opened concurrently. Make it
`std::atomic<bool>` with relaxed ordering, since it is always set to the
same value.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@alexey-milovidov alexey-milovidov self-assigned this Apr 10, 2026
@alexey-milovidov
alexey-milovidov merged commit d250fae into ClickHouse/v10.10.fb Apr 10, 2026
55 checks passed
alexey-milovidov added a commit to ClickHouse/ClickHouse that referenced this pull request Apr 12, 2026
The global `bool pmull_runtime_flag` is written from `IsFastCrc32Supported`
and `Choose_Extend` without synchronization, causing a TSan report when
multiple RocksDB instances are opened concurrently.

The fix makes it `std::atomic<bool>` with relaxed ordering, since it is
always set to the same value.

ClickHouse/rocksdb#29
https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=72bdd3a2f384f33510436950ddfd79288573165d&name_0=MasterCI&name_1=Stress%20test%20%28arm_tsan%29

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@azat

azat commented Apr 17, 2026 •

Copy link
Copy Markdown
Member

meta#14093

alexey-milovidov pushed a commit to original-brownbear/ClickHouse that referenced this pull request Sep 21, 2026
The submodule now points to `ClickHouse/v11.8.1` in the ClickHouse fork
(ClickHouse/rocksdb#35), which is upstream tag
`v11.8.1` plus the existing ClickHouse patch that makes
`pmull_runtime_flag` in `crc32c` a `std::atomic<bool>` (TSan fix from
ClickHouse/rocksdb#29), exactly as the previous
`ClickHouse/v10.10.fb` pin did.

Adaptations:
- `contrib/rocksdb-cmake/CMakeLists.txt`: add the 13 library sources that
  upstream added to `LIB_SOURCES` between v10.10.1 and v11.8.1
  (blob partition manager, blob gen2 format, blob write batch transformer,
  `version_util`, read-path blob resolver, multi-scan index iterator,
  coroutine stats and I/O dispatcher, copy engine, sorted run builder,
  trie index).
- `StorageEmbeddedRocksDB`: RocksDB 11.0 removed the raw `DB *` overloads of
  `DB::Open` and `DB::OpenForReadOnly`; use the `std::unique_ptr<DB>`
  overloads instead.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants