Skip to content

Data race detected when compiling app under TSan #289

Open

Description

@iMostfa

Hello Team,






running the app under TSan results in the following data race, i can't verify if it's causing crashes/inconstancies on prod, but in general data races could cause issues.

most likely we need a synchronised NSDictionary

==================
�[1m�[31mWARNING: ThreadSanitizer: data race (pid=69950)
�[1m�[0m�[1m�[34m  Read of size 8 at 0x000158142c50 by thread T13:
�[1m�[0m
    #0 __54-[NSDictionary(MPCaseInsensitive) caseInsensitiveKey:]_block_invoke NSDictionary+MPCaseInsensitive.m:16 (mParticle_Apple_SDK:arm64+0x1f53d4)
    #1 __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ <null>:584394248 (CoreFoundation:arm64+0x91c04)
    #2 _dispatch_client_callout2 <null>:584394248 (libdispatch.dylib:arm64+0x39b0)

�[1m�[34m  Previous write of size 8 at 0x000158142c50 by thread T7:
�[1m�[0m    #0 __copy_helper_block_e8_32s40r mParticle.m (mParticle_Apple_SDK:arm64+0x33620)
    #1 _call_copy_helpers_excp <null>:584394248 (libsystem_blocks.dylib:arm64+0x10b4)
    #2 __NSCollectionHandleConcurrentEnumerationIfSpecified <null>:584394248 (CoreFoundation:arm64+0x15157c)
    #3 -[MPBackendController setUserAttributeChange:completionHandler:] MPBackendController.m:544 (mParticle_Apple_SDK:arm64+0x57a0c)
    #4 -[MPBackendController setUserAttribute:value:timestamp:completionHandler:] MPBackendController.m:1726 (mParticle_Apple_SDK:arm64+0x6b014)
    #5 __40-[MParticleUser setUserAttribute:value:]_block_invoke MParticleUser.m:286 (mParticle_Apple_SDK:arm64+0x425a8)
    #6 __tsan::invoke_and_release_block(void*) <null>:584394248 (libclang_rt.tsan_iossim_dynamic.dylib:arm64+0x77ee0)
    #7 _dispatch_client_callout <null>:584394248 (libdispatch.dylib:arm64+0x3974)

�[1m�[32m  Location is heap block of size 48 at 0x000158142c30 allocated by thread T7:
�[1m�[0m    #0 malloc <null>:584394248 (libclang_rt.tsan_iossim_dynamic.dylib:arm64+0x4fa48)
    #1 _malloc_type_malloc_outlined <null>:584394248 (libsystem_malloc.dylib:arm64+0xf3ec)
    #2 __NSCollectionHandleConcurrentEnumerationIfSpecified <null>:584394248 (CoreFoundation:arm64+0x15157c)
    #3 -[MPBackendController setUserAttributeChange:completionHandler:] MPBackendController.m:544 (mParticle_Apple_SDK:arm64+0x57a0c)
    #4 -[MPBackendController setUserAttribute:value:timestamp:completionHandler:] MPBackendController.m:1726 (mParticle_Apple_SDK:arm64+0x6b014)
    #5 __40-[MParticleUser setUserAttribute:value:]_block_invoke MParticleUser.m:286 (mParticle_Apple_SDK:arm64+0x425a8)
    #6 __tsan::invoke_and_release_block(void*) <null>:584394248 (libclang_rt.tsan_iossim_dynamic.dylib:arm64+0x77ee0)
    #7 _dispatch_client_callout <null>:584394248 (libdispatch.dylib:arm64+0x3974)

�[1m�[36m  Thread T13 (tid=12827004, running) is a GCD worker thread

�[1m�[0m�[1m�[36m  Thread T7 (tid=12826816, running) is a GCD worker thread

�[1m�[0mSUMMARY: ThreadSanitizer: data race NSDictionary+MPCaseInsensitive.m:16 in __54-[NSDictionary(MPCaseInsensitive) caseInsensitiveKey:]_block_invoke
==================

Activity

  1. changed the title [-]Data race detected when ompiling app under TSan[/-] [+]Data race detected when compiling app under TSan[/+] on Sep 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions