Skip to content
This repository has been archived by the owner on Jan 19, 2018. It is now read-only.

Core Data Multithreading Violations #5

Closed
toto opened this issue Apr 27, 2016 · 2 comments
Closed

Core Data Multithreading Violations #5

toto opened this issue Apr 27, 2016 · 2 comments

Comments

@toto
Copy link

toto commented Apr 27, 2016

Description

The SDK violates the Core Data Multithreading contract which can lead to crashes.

This is AFAICT happens when calling any instance method of the Storage class without using the performBlock() method on the managed object context which happens if you do not use the SDK from the main thread. Since this is a tracking SDK non-main-thread usage should be the norm, not the exception.

Generally the managed object context of the Storage class is in .MainQueueConcurrencyType which is completely inappropriate for a tracking framework especially since the whole API is async. This type should only be used for UI work, which the SDK does not do.

Take a look at the core data concurrency documentation, this is really, really, really bad for a SDK. Esp. since it makes debugging your own core data driven app basically impossible.

Steps to reproduce

  1. Integrate the SDK into your app
  2. Launch the app with -com.apple.CoreData.ConcurrencyDebug 1 as a launch argument (set in the schemes)
  3. Watch the exceptions

Expected Result

No multithreading violations

Workaround

Call any and all methods of the SDK only from the main queue/thread.

@d-theo
Copy link
Contributor

d-theo commented Apr 28, 2016

Hi, we are aware of the problem and are currently working on it. The problem is that the SDK performs tracking but also has a small part of UI (the debugger feature), that's why we are still with .MainQueueConcurrencyType.
The performBlock fix is in progress and will be released soon.

@d-theo
Copy link
Contributor

d-theo commented May 4, 2016

The new release 09cf221 should fix the issue

@d-theo d-theo closed this as completed May 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants