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

Deadlock getting ARTRealtimeChannel between two dispatch_sync (ui queue vs ably main queue) #1029

Closed
eungkyu opened this issue Jun 24, 2020 · 3 comments · Fixed by #1064
Closed
Assignees
Labels
bug Something isn't working. It's clear that this does need to be fixed.

Comments

@eungkyu
Copy link

eungkyu commented Jun 24, 2020

Which version of the Ably SDK are you using?

1.1.23

On which platform does the issue happen?

iOS12

Are you using Carthage?

no

Are you using Cocoapods?

yes, 1.9.3

Which version of Xcode are you using?

Xcode 11.5 Build version 11E608c

What did you do?

Describe the problem.
I called

let ablyChannel = ably.channels.get("connected-user:\(myUid)")

from UI queue (viewDidLoad)
but it stuck by deadlock in ARTChannel.m:83 which is

dispatch_sync(_queue, ^{
    channel = [self _getChannel:name options:options addPrefix:true];
});
    return channel;
}

스크린샷 2020-06-24 오후 12 18 12

other queue (io.ably.main) is stuck in
ARTPush.m:110

            dispatch_sync(dispatch_get_main_queue(), ^{
                delegate = UIApplication.sharedApplication.delegate;
            });

스크린샷 2020-06-24 오후 12 18 38

What did you expect to happen?

ably.channels.get function does not return by deadlock

What happened instead?

ably.channels.get function should return

Tip: set the log level to debug. E.g. realtime.logger.logLevel = .debug and take a look at our troubleshooting guide

Link to sample project

Feel free to link to a sample project that showcases the issue.

P.S. If you are an Ably Enterprise customer, please get in touch with a link to this issue to get prioritized support.

@QuintinWillison
Copy link
Contributor

Hello @eungkyu and thanks for your detailed bug report. We really appreciate the effort you've gone to in explaining the problem you are encountering.

We're having a look now and either myself or one of our other engineers on the iOS side of things will report back when we either have some questions for you, a solution or can confirm this is a bug. 😁

@ricardopereira
Copy link
Contributor

Hello @eungkyu. Does this happens occasionally or can you reproduce the deadlock every time you access the channel?

@eungkyu
Copy link
Author

eungkyu commented Jun 25, 2020

This happens occasionally. It's hard to reproduce on purpose, but I've seen two or three times randomly.

@ricardopereira ricardopereira self-assigned this Jun 26, 2020
@ricardopereira ricardopereira added the bug Something isn't working. It's clear that this does need to be fixed. label Jun 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working. It's clear that this does need to be fixed.
Development

Successfully merging a pull request may close this issue.

3 participants