mirror of
https://github.com/hanzoai/datastore.git
synced 2026-09-26 13:55:07 +00:00
Bump contrib/libdeflate: fix data race in the CPU-feature global
The previous bump (cb6b5c9) made the per-codec dispatch function pointers
(`crc32_impl`, `adler32_impl`, ...) atomic, but each dispatcher still calls
`get_x86_cpu_features` / `get_arm_cpu_features`, which lazily initialize the
global `libdeflate_x86_cpu_features` / `libdeflate_arm_cpu_features` bitmask on
the first call. That global was only `volatile`, so a plain load racing with
the store in `libdeflate_init_*_cpu_features` is still undefined behavior and
was flagged by ThreadSanitizer:
WARNING: ThreadSanitizer: data race
Write ... libdeflate_init_x86_cpu_features cpu_features.c:210
Read ... get_x86_cpu_features cpu_features.h:62
Location is global 'libdeflate_x86_cpu_features'
It reproduced as a "Server died" failure under TSan when two HTTP connections
first compressed a gzip error response concurrently (e.g.
`test_profile_max_sessions_for_user` on the amd_tsan integration shard).
The global is now accessed with relaxed `__atomic_load_n` / `__atomic_store_n`,
matching the dispatch-pointer fix. Fork commit:
https://github.com/ClickHouse/libdeflate/commit/ec0718b
Related: https://github.com/ClickHouse/libdeflate/pull/5
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
7626119d5f
commit
d1038006e9
Vendored
+1
-1
Submodule contrib/libdeflate updated: cb6b5c96c7...ec0718b8e0
Reference in New Issue
Block a user