Skip to content

Data Race in rcccd_setSearchQueueNames at g_searchQueueNames #337

@thebrandontyler

Description

@thebrandontyler

Describe the bug
My iOS application using Rollbar has started to crash due to dereferencing a garbage pointer. After running thread sanitizer on my application, the thread sanitizer reported a "Data race in rcccd_setSearchQueueNames at g_searchQueueNames."

To Reproduce
Steps to reproduce the behavior:

  1. Add Rollbar.initWithConfiguration(config) to application didFinishLaunchingWithOptions in AppDelegate
  2. Edit scheme and turn on thread sanitizer in diagnostics
  3. Run the iOS app and the thread sanitizer will report the data race error

Expected behavior
No data race should happen when using Rollbar (unless I am somehow using it incorrectly)

Thread Sanitizer Report

WARNING: ThreadSanitizer: data race (pid=86203)
  Write of size 1 at 0x0001053db564 by main thread:
    0 rcccd_setSearchQueueNames <null> (App:arm64+0x100342934)
    1 rc_setSearchQueueNames <null> (App:arm64+0x100341da4)
    2 -[RollbarCrashHandler setSearchQueueNames:] <null> (App:arm64+0x100345d78)
    3 -[RollbarCrashCollector install] <null> (App:arm64+0x10039f798)
    4 -[RollbarInfrastructure configureWith:] <null> (App:arm64+0x1003a0c90)
    5 +[Rollbar initWithConfiguration:] <null> (App:arm64+0x10039c6b8)
    6 closure #1 @Swift.MainActor () -> () in App.AppDelegate.application(_: __C.UIApplication, didFinishLaunchingWithOptions: Swift.Optional<Swift.Dictionary<__C.UIApplicationLaunchOptionsKey, Any>>) -> Swift.Bool <null> (App:arm64+0x10010a8c8)
    7 reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_unowned @convention(block) () -> () <null> (App:arm64+0x1001b7b60)
    8 __tsan::invoke_and_release_block(void*) <null> (libclang_rt.tsan_iossim_dynamic.dylib:arm64+0x7b8a8)
    9 _dispatch_client_callout <null> (libdispatch.dylib:arm64+0x5938)
    10 <null> <null> (dyld:arm64+0x1554)

  Previous read of size 1 at 0x0001053db564 by thread T12:
    0 monitorCachedData <null> (App:arm64+0x1003425c8)

  Location is global 'g_searchQueueNames' at 0x0001053db564 (App +0x100527564)

  Thread T12 (tid=13459797, running) created by main thread at:
    0 pthread_create <null> (libclang_rt.tsan_iossim_dynamic.dylib:arm64+0x2f8ac)
    1 rcccd_init <null> (App:arm64+0x100342354)
    2 rc_install <null> (App:arm64+0x100341a80)
    3 -[RollbarCrashHandler install] <null> (App:arm64+0x10034696c)
    4 -[RollbarCrashInstallation install] <null> (App:arm64+0x10034e94c)
    5 -[RollbarCrashCollector install] <null> (App:arm64+0x10039f6e4)
    6 -[RollbarInfrastructure configureWith:] <null> (App:arm64+0x1003a0c90)
    7 +[Rollbar initWithConfiguration:] <null> (App:arm64+0x10039c6b8)
    8 closure #1 @Swift.MainActor () -> () in App.AppDelegate.application(_: __C.UIApplication, didFinishLaunchingWithOptions: Swift.Optional<Swift.Dictionary<__C.UIApplicationLaunchOptionsKey, Any>>) -> Swift.Bool <null> (App:arm64+0x10010a8c8)
    9 reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_unowned @convention(block) () -> () <null> (App:arm64+0x1001b7b60)
    10 __tsan::invoke_and_release_block(void*) <null> (libclang_rt.tsan_iossim_dynamic.dylib:arm64+0x7b8a8)
    11 _dispatch_client_callout <null> (libdispatch.dylib:arm64+0x5938)
    12 <null> <null> (dyld:arm64+0x1554)

SUMMARY: ThreadSanitizer: data race in rcccd_setSearchQueueNames+0x24
==================

Rollbar-Apple SDK version: v3.2.0

Calling the SDK from (x-mark all suitable):
[] Objective-C
[X] Swift
[] Other:

Runtime environment (please complete the following information as applicable):

  • Device: iPad
  • OS: iOS
  • OS version: 16.x & 17.x
  • Browser (Using Rollbar in iOS Application)
  • Browser version: (Using Rollbar in iOS Application)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions