Does Core Data have a serious problem?
Does Core Data have a serious problem?
- Subject: Does Core Data have a serious problem?
- From: Ruotger Skupin <email@hidden>
- Date: Thu, 3 May 2007 12:03:42 +0200
Hi,
Disclaimer: I am being heretic up-front to pique your interest, no
offense meant, of course.
Ok, I'm trying to put the facts down systematically, please correct
me on any point if I'm wrong:
1. Core Data is not inherently thread safe. To use Core Data in a
background thread, you have to use a context for each thread (or use
a huge lock all over Core Data but we don't go there. Besides
Bindings don't lock anything...)
2. To share new objects or object changes/deletions to other
contexts, one has to save the context. All new/changed/deleted
objects are propagated to disk by the store coordinator. Once the
objects are on disk they are accessible by the other contexts.
3. This can take a while (especially with an SQL store).
4. The context seems to lock the store coordinator during a save!!!
(ouch!)
5. The data of an object is not automatically obtained from the
store. When the data is accessed and it's not there, it then is
obtained from the store. This is called a fault, firing a fault or
faulting. (I haven't got the hang of this part of the terminology yet)
6. The context locks the store coordinator during the firing of a
fault (at least partially).
7. Bindings tend to sometimes access an object's data at surprising
(or at least uncontrollable) times.
So taken all this together: When your app does a lengthy save
operation in a background context, it can hang pretty easily
(spinning beach ball) while the save operation is under way.
To the list:
What is the best strategy around this problem?
To any listening Apple engineer:
Do you want me to file this as a bug?
Roddi
P.S.: Locks are like tanks - powerful, slow, safe, expensive, and
prone to getting you stuck. --- http://ridiculousfish.com/blog/
archives/2007/02/17/barrier/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden