Skip to content

Fix TSan races in J2ObjC objc-sync recycling and init - #2935

Merged
copybara-service[bot] merged 1 commit into
masterfrom
test_1019227499
Nov 23, 2026
Merged

copybara-service[bot] merged 1 commit into
masterfrom
test_1019227499

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Fix TSan races in J2ObjC objc-sync recycling and init

  • Make SyncData::threadCount an atomic_int using C11 <stdatomic.h> release-acquire ordering on lock-free release/reuse and remove __attribute__((disable_sanitizer_instrumentation)) from id2SyncCacheItem.
  • Guard sRecursiveLockAttr initialization in recursiveAttributes() with dispatch_once instead of an unsynchronized boolean.
  • Add SynchronizedTest (synchronized_test_ios / SynchronizedTest) verifying happens-before across objc-sync hash-bucket collisions and SyncData recycling.
  • Add ObjcSyncFirstUseTest (objc_sync_first_use_test_ios) exercising concurrent first-time @synchronized entry across distinct hash buckets.

@copybara-service
copybara-service Bot force-pushed the test_1019227499 branch 3 times, most recently from 8f44301 to 66198b9 Compare November 23, 2026 17:18
@copybara-service copybara-service Bot changed the title Fix TSan happens-before gap on SyncData recycling in J2ObjC objc-sync Fix TSan races in J2ObjC objc-sync recycling and init Nov 23, 2026
- Make `SyncData::threadCount` an `atomic_int` using C11 `<stdatomic.h>` release-acquire ordering on lock-free release/reuse and remove `__attribute__((disable_sanitizer_instrumentation))` from `id2SyncCacheItem`.
- Guard `sRecursiveLockAttr` initialization in `recursiveAttributes()` with `dispatch_once` instead of an unsynchronized boolean.
- Add `SynchronizedTest` (`synchronized_test_ios` / `SynchronizedTest`) verifying happens-before across `objc-sync` hash-bucket collisions and `SyncData` recycling.
- Add `ObjcSyncFirstUseTest` (`objc_sync_first_use_test_ios`) exercising concurrent first-time `@synchronized` entry across distinct hash buckets.

PiperOrigin-RevId: 1028259251
@copybara-service
copybara-service Bot merged commit dc94095 into master Nov 23, 2026
2 checks passed
@copybara-service
copybara-service Bot deleted the test_1019227499 branch November 23, 2026 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant