3lvis / DATAStack

100% Swift Simple Boilerplate Free Core Data Stack. NSPersistentContainer
Other
214 stars 44 forks source link

Crash when using Sync #56

Closed wh33ler closed 8 years ago

wh33ler commented 8 years ago

I have quite a big sync process. After running it some times with different data I randomly get the following crash which doesn't happen when I get back to DataSTack version 4.3.0 and Sync version 1.6.5. Any Idea how to fix this?

Crashed: com.apple.main-thread 0 CoreFoundation 0x181c93070 -[NSSetM addObject:] + 476 1 CoreFoundation 0x181c8db00 -[NSMutableSet unionSet:] + 776 2 CoreData 0x183ca895c -[NSManagedObjectContext _mergeChangesFromDidSaveDictionary:usingObjectIDs:] + 3144 3 CoreData 0x183ca8c20 -[NSManagedObjectContext mergeChangesFromContextDidSaveNotification:] + 500 4 DATAStack 0x10049e250 _TPATFFC9DATAStack9DATAStack24backgroundContextDidSaveFzCSo14NSNotificationT_U_FTT + 132 5 CoreData 0x183ca908c developerSubmittedBlockToNSManagedObjectContextPerform + 196 6 libdispatch.dylib 0x1817f547c _dispatch_client_callout + 16 7 libdispatch.dylib 0x1817fab84 _dispatch_main_queue_callback_4CF + 1844 8 CoreFoundation 0x181d60dd8 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 12 9 CoreFoundation 0x181d5ec40 __CFRunLoopRun + 1628 10 CoreFoundation 0x181c88d10 CFRunLoopRunSpecific + 384 11 GraphicsServices 0x183570088 GSEventRunModal + 180 12 UIKit 0x186f55f70 UIApplicationMain + 204

3lvis commented 8 years ago

@wh33ler Hi,

Could you give some more information on how big is the data set and if it involves NSData, complex relationships or anything heavy?

I need to be able to reproduce the bug to figure out a fix.

3lvis commented 8 years ago

Also, are this items being displayed on a NSFetchedResultsController? Or do you just a simple NSFetchRequest and store the results in an array?

wh33ler commented 8 years ago

sorry for the late reply. The dataset is about 5k items big with a lot of relationships. I don't use any NSFetchedResultsController. I reproduce is as follows.

  1. Sync the big data into a clean db.
  2. Use the data in several views and with RAC involved
  3. Drop Database
  4. Resync the big data
  5. Crash while syncing

Hope this helps a bit.

3lvis commented 8 years ago

I did some performance improvements on https://github.com/hyperoslo/Sync/releases/tag/1.7.2, let me know if that fixes your issue.

I'm trying some things https://github.com/3lvis/SyncPerformance it would help a lot of you could find a way to reproduce it, otherwise I'm not sure how I can fix it.

wh33ler commented 8 years ago

Ok. I went back to the current version and couldn't reproduce the crash anymore. Looks like the last release fixed the issue. What I noticed as well, is that the memory footprint on a very big sync call is much smaller then before. Maybe that plays into it. Thx for the help

3lvis commented 8 years ago

That's great news!!