Skip to content
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

Data race in -[AMAMetricaPersistentConfiguration deviceID] #25

Closed
lisindima opened this issue Oct 2, 2024 · 1 comment
Closed

Data race in -[AMAMetricaPersistentConfiguration deviceID] #25

lisindima opened this issue Oct 2, 2024 · 1 comment

Comments

@lisindima
Copy link

lisindima commented Oct 2, 2024

πŸ“š AppMetrica SDK Version

5.8.0

πŸ› οΈ Xcode Version

Version 16.0 (16A242d)

πŸ“± Device Information

iPhone 16 Pro, iOS 18 (Simulator)

βš™οΈ Installation Method

Swift Package Manager

πŸ“ Description

Π‘Π½ΠΈΠΌΠΎΠΊ экрана 2024-10-02 Π² 14 46 24

πŸ” Reproducing the issue

  1. Enable ThreadSanitizer in the schema
  2. Launch the application

πŸ“‹ Relevant AppMetrica Log Output or Crash Logs

WARNING: ThreadSanitizer: data race (pid=87686)
Write of size 8 at 0x00010925dc08 by thread T3 (mutexes: write M0):
#0 -[AMAMetricaPersistentConfiguration deviceID] (ENVA.debug.dylib:arm64+0xdba550)
#1 +[AMAStartupClientIdentifierFactory startupClientIdentifier] (ENVA.debug.dylib:arm64+0xd81020)
#2 +[AMAApplicationStateManager updateApplicationState:] (ENVA.debug.dylib:arm64+0xe5e274)
#3 +[AMAApplicationStateManager applicationState] (ENVA.debug.dylib:arm64+0xe5ddd4)
#4 -[AMAAppMetricaCrashes updateCrashContextQuickly:] (ENVA.debug.dylib:arm64+0xf7376c)
#5 __47-[AMAAppMetricaCrashes updateCrashContextAsync]_block_invoke (ENVA.debug.dylib:arm64+0xf733ec)
#6 __23-[AMAExecutor execute:]_block_invoke (ENVA.debug.dylib:arm64+0xf05bf8)
#7 __tsan::invoke_and_release_block(void*) (libclang_rt.tsan_iossim_dynamic.dylib:arm64+0x7bccc)
#8 _dispatch_client_callout (libdispatch.dylib:arm64+0x67b4)

Previous read of size 8 at 0x00010925dc08 by thread T6:
#0 -[AMAMetricaPersistentConfiguration deviceID] (ENVA.debug.dylib:arm64+0xdba47c)
#1 -[AMADispatcher canPerformDispatchWithApiKey:error:] (ENVA.debug.dylib:arm64+0xe27f14)
#2 -[AMADispatcher performSyncReport] (ENVA.debug.dylib:arm64+0xe274d0)
#3 __30-[AMADispatcher performReport]_block_invoke (ENVA.debug.dylib:arm64+0xe26d7c)
#4 __23-[AMAExecutor execute:]_block_invoke (ENVA.debug.dylib:arm64+0xf05bf8)
#5 __tsan::invoke_and_release_block(void*) (libclang_rt.tsan_iossim_dynamic.dylib:arm64+0x7bccc)
#6 _dispatch_client_callout (libdispatch.dylib:arm64+0x67b4)

Location is heap block of size 64 at 0x00010925dc00 allocated by main thread:
#0 calloc (libclang_rt.tsan_iossim_dynamic.dylib:arm64+0x53b90)
#1 malloc_type_calloc_outlined (libsystem_malloc.dylib:arm64+0xfe68)
#2 -[AMAAppMetricaImpl initWithHostStateProvider:executor:] (ENVA.debug.dylib:arm64+0xd60dd4)
#3 __27+[AMAAppMetrica sharedImpl]block_invoke (ENVA.debug.dylib:arm64+0xd5d6b4)
#4 dispatch_once (libclang_rt.tsan_iossim_dynamic.dylib:arm64+0x7cb1c)
#5 +[AMAAppMetrica sharedImpl] (ENVA.debug.dylib:arm64+0xd5d57c)
#6 +[AMAAppMetrica setupExternalServices] (ENVA.debug.dylib:arm64+0xd58bec)
#7 +[AMAAppMetrica activateWithConfiguration:] (ENVA.debug.dylib:arm64+0xd5a104)
#8 ENVA.AppDelegate.application(
: __C.UIApplication, didFinishLaunchingWithOptions: Swift.Optional<Swift.Dictionary<__C.UIApplicationLaunchOptionsKey, Any>>) -> Swift.Bool (ENVA.debug.dylib:arm64+0x24a98)
#9 @objc ENVA.AppDelegate.application(
: __C.UIApplication, didFinishLaunchingWithOptions: Swift.Optional<Swift.Dictionary<__C.UIApplicationLaunchOptionsKey, Any>>) -> Swift.Bool (ENVA.debug.dylib:arm64+0x24fa8)
#10 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] (UIKitCore:arm64+0xe1e4e8)
#11 static ENVA.AppDelegate.$main() -> () (ENVA.debug.dylib:arm64+0x253e0)
#12 __debug_main_executable_dylib_entry_point (ENVA.debug.dylib:arm64+0x28a44)
#13 (dyld:arm64+0x140c)

Mutex M0 (0x0001097047b0) created at:
#0 objc_sync_enter (libclang_rt.tsan_iossim_dynamic.dylib:arm64+0x79678)
#1 -[AMAMetricaPersistentConfiguration deviceIDHash] (ENVA.debug.dylib:arm64+0xdbacec)
#2 -[AMAStartupController hasIdentifiers] (ENVA.debug.dylib:arm64+0xeadeb8)
#3 -[AMAStartupController upToDate] (ENVA.debug.dylib:arm64+0xeacfbc)
#4 -[AMASelfReportExecutionConditionChecker canBeExecuted:] (ENVA.debug.dylib:arm64+0xef60ec)
#5 -[AMADispatchStrategy canBeExecuted:] (ENVA.debug.dylib:arm64+0xef358c)
#6 __60-[AMAAppMetricaImpl dispatchStrategyWantsReportingToHappen:]_block_invoke (ENVA.debug.dylib:arm64+0xd6cd68)
#7 __23-[AMAExecutor execute:]_block_invoke (ENVA.debug.dylib:arm64+0xf05bf8)
#8 __tsan::invoke_and_release_block(void*) (libclang_rt.tsan_iossim_dynamic.dylib:arm64+0x7bccc)
#9 _dispatch_client_callout (libdispatch.dylib:arm64+0x67b4)

Thread T3 (tid=2593916, running) is a GCD worker thread

Thread T6 (tid=2593920, running) is a GCD worker thread

SUMMARY: ThreadSanitizer: data race (/Users/dima/Library/Developer/CoreSimulator/Devices/5D9B4E81-0C7F-4FB9-BB80-2FCB728A3CA9/data/Containers/Bundle/Application/3D96421B-B44B-49F9-A221-664EE1CBD0CA/ENVA.app/ENVA.debug.dylib:arm64+0xdba550) in -[AMAMetricaPersistentConfiguration deviceID]+0x114

πŸ“¦ Attach Package.resolved (Swift Package Manager Users)

No response

🍫 Attach Podfile.lock (CocoaPods Users)

No response

@Sergey70
Copy link
Member

Sergey70 commented Dec 3, 2024

Handling of identifiers has been reworked, including the issue, and it will be in version 5.9.0, which is going to be released in a few days.

Thanks for your patience and support!

@Sergey70 Sergey70 closed this as completed Dec 3, 2024
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

No branches or pull requests

2 participants