Closed S2Ler closed 2 years ago
Configuration
Steps to Reproduce Call many sendTurnstileEvent events with Thread Sanitizer turned on.
sendTurnstileEvent
Expected No data races.
Logging
================== WARNING: ThreadSanitizer: data race (pid=55699) Write of size 8 at 0x00010a495850 by thread T6: #0 -[MMELocationManager locationManager] MMELocationManager.m:42 (MapboxMobileEvents:arm64+0x357d0) #1 -[MMELocationManager locationAuthorizationString] MMELocationManager.m:83 (MapboxMobileEvents:arm64+0x36144) #2 -[MMEEventsManager sendTurnstileEvent] MMEEventsManager.m:345 (MapboxMobileEvents:arm64+0x4ed98) #3 closure #1 in NavigationEventsManager.start() <null>:111260140 (Example:arm64+0x10063dc9c) #4 partial apply for closure #1 in NavigationEventsManager.start() <null>:111260140 (Example:arm64+0x10063dcf4) #5 partial apply for thunk for @callee_guaranteed (@unowned Int) -> () <null>:111260140 (libswiftDispatch.dylib:arm64+0x42f4) #6 _dispatch_client_callout2 <null>:111260140 (libdispatch.dylib:arm64+0x5858) Previous read of size 8 at 0x00010a495850 by main thread: #0 -[MMELocationManager locationManager] MMELocationManager.m:41 (MapboxMobileEvents:arm64+0x356f4) #1 -[MMELocationManager accuracyAuthorizationString] MMELocationManager.m:106 (MapboxMobileEvents:arm64+0x364d8) #2 -[MMEEventsManager sendTurnstileEvent] MMEEventsManager.m:350 (MapboxMobileEvents:arm64+0x4f02c) #3 closure #1 in NavigationEventsManager.start() <null>:111260140 (Example:arm64+0x10063dc9c) #4 partial apply for closure #1 in NavigationEventsManager.start() <null>:111260140 (Example:arm64+0x10063dcf4) #5 partial apply for thunk for @callee_guaranteed (@unowned Int) -> () <null>:111260140 (libswiftDispatch.dylib:arm64+0x42f4) #6 _dispatch_client_callout2 <null>:111260140 (libdispatch.dylib:arm64+0x5858) #7 _swift_dispatch_apply_current <null>:111260140 (libswiftDispatch.dylib:arm64+0x43a0) #8 NavigationEventsManager.init(activeNavigationDataSource:passiveNavigationDataSource:accessToken:mobileEventsManager:) <null>:111260140 (Example:arm64+0x10063c404) #9 NavigationEventsManager.__allocating_init(activeNavigationDataSource:passiveNavigationDataSource:accessToken:mobileEventsManager:) <null>:111260140 (Example:arm64+0x10063beac) #10 PassiveLocationManager.init(directions:systemLocationManager:eventsManagerType:userInfo:) <null>:111260140 (Example:arm64+0x10066b38c) #11 PassiveLocationManager.__allocating_init(directions:systemLocationManager:eventsManagerType:userInfo:) <null>:111260140 (Example:arm64+0x10066acac) #12 ViewController.setupPassiveLocationProvider() ViewController+FreeDrive.swift:16 (Example:arm64+0x10003c204) #13 ViewController.configure(_:) ViewController.swift:146 (Example:arm64+0x10000d37c) #14 ViewController.navigationMapView.didset ViewController.swift:44 (Example:arm64+0x100007130) #15 ViewController.navigationMapView.setter ViewController.swift (Example:arm64+0x10000755c) #16 ViewController.viewWillAppear(_:) ViewController.swift:132 (Example:arm64+0x10000cacc) #17 @objc ViewController.viewWillAppear(_:) <compiler-generated> (Example:arm64+0x10000d0a8) #18 -[UIViewController _setViewAppearState:isAnimating:] <null>:111260140 (UIKitCore:arm64+0x4bf260) #19 <null> <null> (0x000106695c04) Location is heap block of size 64 at 0x00010a495840 allocated by main thread: #0 calloc <null>:111260140 (libclang_rt.tsan_iossim_dynamic.dylib:arm64+0x50de4) #1 _objc_rootAllocWithZone <null>:111260140 (libobjc.A.dylib:arm64+0x171b0) #2 dispatch_once <null>:111260140 (libclang_rt.tsan_iossim_dynamic.dylib:arm64+0x7130c) #3 -[MMEEventsManager locationManager] MMEEventsManager.m:600 (MapboxMobileEvents:arm64+0x55a1c) #4 -[MMEEventsManager sendTurnstileEvent] MMEEventsManager.m:345 (MapboxMobileEvents:arm64+0x4ed54) #5 closure #1 in NavigationEventsManager.start() <null>:111260140 (Example:arm64+0x10063dc9c) #6 partial apply for closure #1 in NavigationEventsManager.start() <null>:111260140 (Example:arm64+0x10063dcf4) #7 partial apply for thunk for @callee_guaranteed (@unowned Int) -> () <null>:111260140 (libswiftDispatch.dylib:arm64+0x42f4) #8 _dispatch_client_callout2 <null>:111260140 (libdispatch.dylib:arm64+0x5858) #9 _swift_dispatch_apply_current <null>:111260140 (libswiftDispatch.dylib:arm64+0x43a0) #10 NavigationEventsManager.init(activeNavigationDataSource:passiveNavigationDataSource:accessToken:mobileEventsManager:) <null>:111260140 (Example:arm64+0x10063c404) #11 NavigationEventsManager.__allocating_init(activeNavigationDataSource:passiveNavigationDataSource:accessToken:mobileEventsManager:) <null>:111260140 (Example:arm64+0x10063beac) #12 PassiveLocationManager.init(directions:systemLocationManager:eventsManagerType:userInfo:) <null>:111260140 (Example:arm64+0x10066b38c) #13 PassiveLocationManager.__allocating_init(directions:systemLocationManager:eventsManagerType:userInfo:) <null>:111260140 (Example:arm64+0x10066acac) #14 ViewController.setupPassiveLocationProvider() ViewController+FreeDrive.swift:16 (Example:arm64+0x10003c204) #15 ViewController.configure(_:) ViewController.swift:146 (Example:arm64+0x10000d37c) #16 ViewController.navigationMapView.didset ViewController.swift:44 (Example:arm64+0x100007130) #17 ViewController.navigationMapView.setter ViewController.swift (Example:arm64+0x10000755c) #18 ViewController.viewWillAppear(_:) ViewController.swift:132 (Example:arm64+0x10000cacc) #19 @objc ViewController.viewWillAppear(_:) <compiler-generated> (Example:arm64+0x10000d0a8) #20 -[UIViewController _setViewAppearState:isAnimating:] <null>:111260140 (UIKitCore:arm64+0x4bf260) #21 <null> <null> (0x000106695c04) Thread T6 (tid=10256305, running) is a GCD worker thread SUMMARY: ThreadSanitizer: data race MMELocationManager.m:42 in -[MMELocationManager locationManager] ================== ThreadSanitizer report breakpoint hit. Use 'thread info -s' to get extended information about the report. ================== WARNING: ThreadSanitizer: data race (pid=55699) Write of size 8 at 0x00010aa3a180 by thread T20: #0 -[MMEMetrics setEventCountTotal:] MMEMetrics.h (MapboxMobileEvents:arm64+0x169cc) #1 -[MMEMetricsManager updateMetricsFromEventQueue:] MMEMetricsManager.m:124 (MapboxMobileEvents:arm64+0x25f88) #2 -[MMEAPIClient postEvents:completionHandler:] MMEAPIClient.m:76 (MapboxMobileEvents:arm64+0x2d440) #3 -[MMEAPIClient postEvent:completionHandler:] MMEAPIClient.m:113 (MapboxMobileEvents:arm64+0x2e3fc) #4 __38-[MMEEventsManager sendTurnstileEvent]_block_invoke MMEEventsManager.m:361 (MapboxMobileEvents:arm64+0x4f724) #5 __tsan::invoke_and_release_block(void*) <null>:111260140 (libclang_rt.tsan_iossim_dynamic.dylib:arm64+0x70514) #6 _dispatch_client_callout <null>:111260140 (libdispatch.dylib:arm64+0x581c) Previous read of size 8 at 0x00010aa3a180 by thread T10: #0 -[MMEMetrics eventCountTotal] MMEMetrics.h:19 (MapboxMobileEvents:arm64+0x16954) #1 -[MMEMetricsManager attributes] MMEMetricsManager.m:248 (MapboxMobileEvents:arm64+0x29938) #2 -[MMEMetricsManager generateTelemetryMetricsEvent] MMEMetricsManager.m:300 (MapboxMobileEvents:arm64+0x2bc0c)
Mobile Telemetry Issues Guide
Configuration
Steps to Reproduce Call many
sendTurnstileEvent
events with Thread Sanitizer turned on.Expected No data races.
Logging
Mobile Telemetry Issues Guide