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

possible deadlock with AWSPinpointAnalyticsClient submitEvents #2419

Closed
ruirodrigues-eyenov opened this issue Apr 7, 2020 · 1 comment
Closed
Assignees
Labels
bug Something isn't working pinpoint Issues related to AWS Pinpoint

Comments

@ruirodrigues-eyenov
Copy link

Describe the bug
AWSPinpointAnalyticsClient:submitEvents does a dispatch_sync(dispatch_get_main_queue(), to get [UIApplication sharedApplication] isRegisteredForRemoteNotifications] result. A dispatch_sync on main queue can lead to a deadlock when events are sent from queues besides the main queue.

To Reproduce
Send an event from a queue other than main queue and block main queue would be the easiest:

DispatchQueue.main.async {
    let waiting = DispatchSemaphore(value: 0)
    DispatchQueue.global(qos: .background).async {
        analyticsClient.record(event)
        analyticsClient.submitEvents()
        waiting.signal()
    }
    waiting.wait()
    print("event sent")
}

Which AWS service(s) are affected?
AWSPinpoint on iOS SDK

Expected behavior
Send events on a queue other than main queue without blocking.

Environment(please complete the following information):

  • AWSPinpoint SDL version: 2.12.1
  • Dependency Manager: Cocoapods
  • Swift Version : 5.2

Device Information (please complete the following information):

  • Device: iPhone, Simulator
  • iOS Version: iOS 13
  • Specific to simulators: no

Additional context
call stack:

* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
....
  * AWSPinpoint`-[AWSPinpointEventRecorder submitAllEvents](self=0x000000028326b0c0, _cmd="submitAllEvents") at AWSPinpointEventRecorder.m:505:5
    AWSPinpoint`-[AWSPinpointAnalyticsClient submitEvents](self=0x00000002803f6a80, _cmd="submitEvents") at AWSPinpointAnalyticsClient.m:160:12
...

* thread #2, queue = 'livery.player.queue'
....
  * AWSPinpoint`+[AWSPinpointNotificationManager runOnMainThread:](self=AWSPinpointNotificationManager, _cmd="runOnMainThread:", codeBlock=0x000000010131b6f0) at AWSPinpointNotificationManager.m:77:9
    AWSPinpoint`+[AWSPinpointNotificationManager isNotificationEnabled](self=AWSPinpointNotificationManager, _cmd="isNotificationEnabled") at AWSPinpointNotificationManager.m:66:5
    AWSPinpoint`-[AWSPinpointEndpointProfile setEndpointOptOut:](self=0x000000028324c9c0, _cmd="setEndpointOptOut:", applicationLevelOptOut=NO) at AWSPinpointEndpointProfile.m:125:46
    AWSPinpoint`-[AWSPinpointTargetingClient currentEndpointProfile](self=0x00000002818359b0, _cmd="currentEndpointProfile") at AWSPinpointTargetingClient.m:104:5
    AWSPinpoint`-[AWSPinpointEventRecorder submitAllEvents](self=0x000000028326b0c0, _cmd="submitAllEvents") at AWSPinpointEventRecorder.m:514:28
    AWSPinpoint`-[AWSPinpointAnalyticsClient submitEvents](self=0x00000002803f6a80, _cmd="submitEvents") at AWSPinpointAnalyticsClient.m:160:12
....
@royjit royjit added the pinpoint Issues related to AWS Pinpoint label Apr 7, 2020
@lawmicha lawmicha added the bug Something isn't working label Apr 17, 2020
@drochetti drochetti added the follow up Requires follow up from maintainers label Oct 20, 2020
@lawmicha lawmicha added pending-triage Issue is pending triage and removed follow up Requires follow up from maintainers labels Oct 1, 2021
@ruisebas ruisebas self-assigned this Oct 31, 2022
@ruisebas ruisebas removed the pending-triage Issue is pending triage label Feb 10, 2023
@ruisebas
Copy link
Member

This has been fixed in 2.30.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pinpoint Issues related to AWS Pinpoint
Projects
None yet
Development

No branches or pull requests

5 participants