-
Notifications
You must be signed in to change notification settings - Fork 32
[BUG] AtomicProperty
deadlocks in heavily concurrent settings
#517
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
Comments
Acknowledged, will get back to you. |
Hi @stephanecopin thanks for your effort. I went through your test case. It looks like not a dead lock issue. You submit too many tasks concurrently, which leads to the system running out of threads. Does our current code cause your app to freeze? |
Hi @muzahidul-opti, indeed, this is basically what is happening. In the meantime, we've resorted to forking the repository and implementing the fix as mentioned in the PR, but ideally it should be fixed here directly. Thanks for looking into it! |
Hi @stephanecopin thanks for the insight. Will get back to you. |
Hello, I know it has been 1 month. This is an update that a ticket is created on our side and we're continuing to investigate. |
Hi, some news about this topic? |
Hi @sergiofresneda, thank you for your patience and for sharing your proposed locking approach with our team. We've thoroughly reviewed the solution, and while it appears to be effective in your sample test case, we are proceeding with caution, as we recognize the potential significant impact it could have on our broader production user base. Considering the impact of the changes, our team has decided not to merge the solution at this time. We want to ensure that any modifications align seamlessly with our user and don't introduce unexpected impacts. We appreciate your understanding in this matter and encourage you to proceed with the forking process, as you mentioned. Rest assured; we are actively exploring potential workarounds. Thank you once again for your collaboration and valuable contribution to our project. |
Uh oh!
There was an error while loading. Please reload this page.
Is there an existing issue for this?
SDK Version
master
iOS Version
Any
Current Behavior
When a lot of work is done concurrently,
AtomicQueue
's getter deadlocks as its internal queue is waiting for be freed up. If the queues doing work are waiting onAtomicQueue
's property value, then they both wait on each other, creating a deadlock.In terms of behavior from the user perspective, if the deadlock happens on the main thread, the app will freeze and the user will have to force-kill the app. This happens mostly on older devices (iPhone 6S/iPhone 7/iPad 7th Gen).
Expected Behavior
AtomicProperty
should never deadlock.Steps To Reproduce
Run this test:
The test never finishes.
The less CPU cores the target device has, the easier is it to reproduce.
Link
See above.
Logs / Stacktraces
No response
Severity
Affecting users
Workaround/Solution
Use a lock that doesn't leverage a queue would fix the issue. For example, using
NSRecursiveLock
:Fixes the deadlock.
Recent Change
No response
Conflicts
No response
The text was updated successfully, but these errors were encountered: