re: "Could not merge data"-error on save in a single moc app
re: "Could not merge data"-error on save in a single moc app
- Subject: re: "Could not merge data"-error on save in a single moc app
- From: Ben Trumbull <email@hidden>
- Date: Thu, 29 Oct 2009 12:05:47 -0700
> I get a "Could not merge changes"-error on save in a single moc app
> (*). The docs state this is a problem of a multi-moc setup:
>
> http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreData/Articles/cdTroubleshooting.html
>
Yes, the MOC you are saving refers to data that has changed out from underneath it in either the PSC or the database file itself. This is an optimistic concurrency control failure.
> The error does not appear on every system and seems to be related to
> when save is called. (race condition?) So far I only have users
> complaining that run Mac OS 10.6. I can rarely reproduce the error
> myself.
>
> Any pointers where to look?
Well, you can break on -[NSManagedObjectContext init], and -save: to see if you really only have 1 MOC. Other than that, breaking on +[NSError errorWithDomain:code:userInfo:] and doing "thread apply all bt" in gdb is usually helpful.
>
> I use garbage collection.
>
> regards
> Ruotger
>
> (*) the context is handed out by a singleton method. I NSAssert() this
> method is only called by the main thread.
Well, it's still possible for code to leak it to another thread if, you say, pass NSManagedObjects around, and then ask them for their MOC.
- Ben
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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