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: Ruotger Skupin <email@hidden>
- Date: Mon, 2 Nov 2009 16:51:28 +0100
On 29.10.2009, at 20:05, Ben Trumbull wrote:
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
Hi,
I've checked all accesses to the moc and by using mogenerator I
generated files that assert that every single access of a managed
object is on the main thread. I still get the "Could not merge data"-
error or sometimes this one:
Printing description of error:
Error Domain=NSCocoaErrorDomain Code=1550 UserInfo=0x5d45490 "balances
is not valid."
balances is a one-way to multiple relation.
Any more ideas?
regards
Ruotger
_______________________________________________
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