drewmccormack / ensembles

A synchronization framework for Core Data.
MIT License
1.63k stars 131 forks source link

Deadlock when saving during a merge #141

Closed drewmccormack closed 10 years ago

drewmccormack commented 10 years ago

A deadlock can occur if a save occurs during a merge. The save monitor is using synchronous peforms on the event queue. The merge calls save on the merge queue, and this somehow triggers activity on the main thread, but that is blocked by the save perform.

Solution is make all save ops non-blocking.

drewmccormack commented 10 years ago

Replaced performBlockAndWait: in save monitor with performBlock:. You now need to be careful to use processPendingChanges... or a merge when terminating, to ensure the event store is fully saved.