Skip to content

[Darwin] ThreadSanitizer failure in test048_MTRDeviceResubscribeOnSubscriptionPool #39292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bzbarsky-apple opened this issue May 30, 2025 · 2 comments · Fixed by #39462
Closed

Comments

@bzbarsky-apple
Copy link
Contributor

Reproduction steps

https://github.com/project-chip/connectedhomeip/actions/runs/15336175175/job/43155220947

2025-05-30T01:21:48.2591020Z WARNING: ThreadSanitizer: data race (pid=37382)
2025-05-30T01:21:48.2591520Z   Read of size 8 at 0x7b0c00108b90 by thread T20:
2025-05-30T01:21:48.2592600Z     #0 __64-[MTRDeviceTests test048_MTRDeviceResubscribeOnSubscriptionPool]_block_invoke_4 <null> (MatterTests:x86_64+0x5eccc9)
2025-05-30T01:21:48.2593730Z     #1 -[MTRDeviceTestDelegate unitTestSubscriptionPoolWorkComplete:] <null> (MatterTests:x86_64+0x405ff1)
2025-05-30T01:21:48.2595090Z     #2 __69-[MTRDevice_Concrete _clearSubscriptionPoolWorkWithProvidedDelegate:]_block_invoke <null> (Matter:x86_64+0x1a3f098)
2025-05-30T01:21:48.2595920Z     #3 __47-[MTRDeviceDelegateInfo callDelegateWithBlock:]_block_invoke <null> (Matter:x86_64+0x1aaf229)
2025-05-30T01:21:48.2596650Z     #4 __tsan::invoke_and_release_block(void*) <null> (libclang_rt.tsan_osx_dynamic.dylib:x86_64h+0x7f72b)
2025-05-30T01:21:48.2597120Z     #5 _dispatch_client_callout <null> (libdispatch.dylib:x86_64+0x3032)
2025-05-30T01:21:48.2597950Z 
2025-05-30T01:21:48.2598400Z   Previous write of size 8 at 0x7b0c00108b90 by main thread:
2025-05-30T01:21:48.2598800Z     #0 __copy_helper_block_e8_32s <null> (MatterTests:x86_64+0x784e)
2025-05-30T01:21:48.2599860Z     #1 _call_copy_helpers_excp <null> (libsystem_blocks.dylib:x86_64+0x16fb)
2025-05-30T01:21:48.2600820Z     #2 -[MTRDeviceTests test048_MTRDeviceResubscribeOnSubscriptionPool] <null> (MatterTests:x86_64+0x5eca38)
2025-05-30T01:21:48.2601150Z     #3 __invoking___ <null> (CoreFoundation:x86_64h+0x60bab)
2025-05-30T01:21:48.2601170Z 
2025-05-30T01:21:48.2601670Z   Location is heap block of size 40 at 0x7b0c00108b70 allocated by main thread:
2025-05-30T01:21:48.2602320Z     #0 malloc <null> (libclang_rt.tsan_osx_dynamic.dylib:x86_64h+0x560ec)
2025-05-30T01:21:48.2603310Z     #1 _Block_copy <null> (libsystem_blocks.dylib:x86_64+0x123e)
2025-05-30T01:21:48.2607980Z     #2 -[MTRDeviceTests test048_MTRDeviceResubscribeOnSubscriptionPool] <null> (MatterTests:x86_64+0x5eca38)
2025-05-30T01:21:48.2608430Z     #3 __invoking___ <null> (CoreFoundation:x86_64h+0x60bab)
2025-05-30T01:21:48.2608450Z 
2025-05-30T01:21:48.2608700Z   Thread T20 (tid=119979, running) is a GCD worker thread

I think this might be the read and write of delegate.onSubscriptionPoolWorkComplete? I wonder whether we should make all these properties on the delegate atomic...

Platform

darwin

Platform Version(s)

No response

Type

CI tested

(Optional) If manually tested please explain why this is only manually tested

No response

Anything else?

No response

@andy31415
Copy link
Contributor

https://github.com/project-chip/connectedhomeip/actions/runs/15436358300/job/43444819147 also seems to show this:

...
2025-06-04T08:16:34.8920680Z WARNING: ThreadSanitizer: data race (pid=29417)
2025-06-04T08:16:34.8921610Z   Read of size 8 at 0x7b0c000f4970 by thread T16:
2025-06-04T08:16:34.8923590Z     #0 __64-[MTRDeviceTests test048_MTRDeviceResubscribeOnSubscriptionPool]_block_invoke_4 <null> (MatterTests:x86_64+0x5eccc9)
2025-06-04T08:16:34.8925510Z     #1 -[MTRDeviceTestDelegate unitTestSubscriptionPoolWorkComplete:] <null> (MatterTests:x86_64+0x405ff1)
2025-06-04T08:16:34.8927600Z     #2 __69-[MTRDevice_Concrete _clearSubscriptionPoolWorkWithProvidedDelegate:]_block_invoke <null> (Matter:x86_64+0x1a3ea48)
2025-06-04T08:16:34.8928250Z     #3 __47-[MTRDeviceDelegateInfo callDelegateWithBlock:]_block_invoke <null> (Matter:x86_64+0x1aaebd9)
2025-06-04T08:16:34.8929060Z     #4 __tsan::invoke_and_release_block(void*) <null> (libclang_rt.tsan_osx_dynamic.dylib:x86_64h+0x7f72b)
2025-06-04T08:16:34.8929410Z     #5 _dispatch_client_callout <null> (libdispatch.dylib:x86_64+0x3032)
2025-06-04T08:16:34.8929420Z 
2025-06-04T08:16:34.8929690Z   Previous write of size 8 at 0x7b0c000f4970 by main thread:
2025-06-04T08:16:34.8929980Z     #0 __copy_helper_block_e8_32s <null> (MatterTests:x86_64+0x784e)
2025-06-04T08:16:34.8930310Z     #1 _call_copy_helpers_excp <null> (libsystem_blocks.dylib:x86_64+0x16fb)
2025-06-04T08:16:34.8930980Z     #2 -[MTRDeviceTests test048_MTRDeviceResubscribeOnSubscriptionPool] <null> (MatterTests:x86_64+0x5eca38)
2025-06-04T08:16:34.8931330Z     #3 __invoking___ <null> (CoreFoundation:x86_64h+0x60bab)
2025-06-04T08:16:34.8931330Z 
2025-06-04T08:16:34.8931690Z   Location is heap block of size 40 at 0x7b0c000f4950 allocated by main thread:
2025-06-04T08:16:34.8932000Z     #0 malloc <null> (libclang_rt.tsan_osx_dynamic.dylib:x86_64h+0x560ec)
2025-06-04T08:16:34.8932240Z     #1 _Block_copy <null> (libsystem_blocks.dylib:x86_64+0x123e)
2025-06-04T08:16:34.8932900Z     #2 -[MTRDeviceTests test048_MTRDeviceResubscribeOnSubscriptionPool] <null> (MatterTests:x86_64+0x5eca38)
2025-06-04T08:16:34.8933210Z     #3 __invoking___ <null> (CoreFoundation:x86_64h+0x60bab)
2025-06-04T08:16:34.8933220Z 
2025-06-04T08:16:34.8933480Z   Thread T16 (tid=100478, running) is a GCD worker thread
2025-06-04T08:16:34.8933480Z 
2025-06-04T08:16:34.8936110Z SUMMARY: ThreadSanitizer: data race (/Users/runner/Library/Developer/Xcode/DerivedData/Matter-fezxjrcgbvmiwkgpcrhtmcinmudo/Build/Products/Debug/MatterTests.xctest/Contents/MacOS/MatterTests:x86_64+0x5eccc9) in __64-[MTRDeviceTests test048_MTRDeviceResubscribeOnSubscriptionPool]_block_invoke_4+0x29
...

@andy31415
Copy link
Contributor

https://github.com/project-chip/connectedhomeip/actions/runs/15499432399/job/43644784197 says:

2025-06-06T21:34:42.9247630Z WARNING: ThreadSanitizer: data race (pid=38803)
2025-06-06T21:34:43.0597900Z   Read of size 8 at 0x7b0c000a1780 by thread T15:
2025-06-06T21:34:43.1607330Z     #0 __64-[MTRDeviceTests test048_MTRDeviceResubscribeOnSubscriptionPool]_block_invoke_4 <null> (MatterTests:x86_64+0x5edba9)
2025-06-06T21:34:43.1768890Z     #1 -[MTRDeviceTestDelegate unitTestSubscriptionPoolWorkComplete:] <null> (MatterTests:x86_64+0x406981)
2025-06-06T21:34:43.1783500Z     #2 __69-[MTRDevice_Concrete _clearSubscriptionPoolWorkWithProvidedDelegate:]_block_invoke <null> (Matter:x86_64+0x1a3c0b8)
2025-06-06T21:34:43.1793110Z     #3 __47-[MTRDeviceDelegateInfo callDelegateWithBlock:]_block_invoke <null> (Matter:x86_64+0x1aacf09)
2025-06-06T21:34:43.1813530Z     #4 __tsan::invoke_and_release_block(void*) <null> (libclang_rt.tsan_osx_dynamic.dylib:x86_64h+0x7f72b)
2025-06-06T21:34:43.1864180Z     #5 _dispatch_client_callout <null> (libdispatch.dylib:x86_64+0x3032)
2025-06-06T21:34:43.1866050Z 
2025-06-06T21:34:43.1867450Z   Previous write of size 8 at 0x7b0c000a1780 by main thread:
2025-06-06T21:34:43.1884410Z     #0 __copy_helper_block_e8_32s <null> (MatterTests:x86_64+0x7abe)
2025-06-06T21:34:43.1888460Z     #1 _call_copy_helpers_excp <null> (libsystem_blocks.dylib:x86_64+0x16fb)
2025-06-06T21:34:43.1893490Z     #2 -[MTRDeviceTests test048_MTRDeviceResubscribeOnSubscriptionPool] <null> (MatterTests:x86_64+0x5ed918)
2025-06-06T21:34:43.1895710Z     #3 __invoking___ <null> (CoreFoundation:x86_64h+0x60bab)
2025-06-06T21:34:43.1900220Z 
2025-06-06T21:34:43.1901660Z   Location is heap block of size 40 at 0x7b0c000a1760 allocated by main thread:
2025-06-06T21:34:43.1904220Z     #0 malloc <null> (libclang_rt.tsan_osx_dynamic.dylib:x86_64h+0x560ec)
2025-06-06T21:34:43.1907880Z     #1 _Block_copy <null> (libsystem_blocks.dylib:x86_64+0x123e)
2025-06-06T21:34:43.1910950Z     #2 -[MTRDeviceTests test048_MTRDeviceResubscribeOnSubscriptionPool] <null> (MatterTests:x86_64+0x5ed918)
2025-06-06T21:34:43.1912650Z     #3 __invoking___ <null> (CoreFoundation:x86_64h+0x60bab)
2025-06-06T21:34:43.1913960Z 
2025-06-06T21:34:43.1916210Z   Thread T15 (tid=121437, running) is a GCD worker thread
2025-06-06T21:34:43.1917870Z 
2025-06-06T21:34:43.1923670Z SUMMARY: ThreadSanitizer: data race (/Users/runner/Library/Developer/Xcode/DerivedData/Matter-fezxjrcgbvmiwkgpcrhtmcinmudo/Build/Products/Debug/MatterTests.xctest/Contents/MacOS/MatterTests:x86_64+0x5edba9) in __64-[MTRDeviceTests test048_MTRDeviceResubscribeOnSubscriptionPool]_block_invoke_4+0x29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants