When collecting Coredata

Some strange coredata error appears in the production application, and I was able to get a crash report.

The following message failed

*** error for object 0x17e400000: unallocated pointer deallocation

*** error for object 0x17fd03730: redistributed pointer was not allocated

And here is the stack trace

Crashed: SQLQueue 0x13ff15250 for datastore.sqlite
SIGABRT ABORT 0x0000000183986014

0 libsystem_kernel.dylib    __pthread_kill + 8
1   libsystem_pthread.dylib  pthread_kill + 112
2   libsystem_c.dylib   abort + 140
3   libsystem_malloc.dylib  _nano_vet_and_size_of_live + 330
4   libsystem_malloc.dylib  nano_free + 220
5   libsqlite3.dylib    sqlite3_finalize + 244
6   CoreData    -[NSSQLiteConnection _finalizeStatement] + 100
7   CoreData    -[NSSQLiteConnection releaseSQLStatement] + 52
8   CoreData    newFetchedRowsForFetchPlan_MT + 2420
9   CoreData    _executeFetchRequest + 72
10  CoreData    -[NSSQLFetchRequestContext executeRequestUsingConnection:] + 60
11  CoreData    __52-[NSSQLDefaultConnectionManager handleStoreRequest:]_block_invoke + 260
12  libdispatch.dylib   _dispatch_client_callout + 16
13  libdispatch.dylib   _dispatch_barrier_sync_f_invoke + 84
14  CoreData    -[NSSQLDefaultConnectionManager handleStoreRequest:] + 208
15  CoreData    -[NSSQLCoreDispatchManager routeStoreRequest:] + 288
16  CoreData    -[NSSQLCore dispatchRequest:withRetries:] + 200
17  CoreData    -[NSSQLCore processFetchRequest:inContext:] + 108
18  CoreData    -[NSSQLCore executeRequest:withContext:error:] + 504
19  CoreData    __65-[NSPersistentStoreCoordinator executeRequest:withContext:error:]_block_invoke + 4512
20  CoreData    -[NSPersistentStoreCoordinator _routeHeavyweightBlock:] + 276
21  CoreData    -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 408
22  CoreData    -[NSManagedObjectContext executeFetchRequest:error:] + 572
23  CoreData    -[NSManagedObjectContext(_NestedContextSupport) _parentObjectsForFetchRequest:inContext:error:] + 456
24  CoreData    __82-[NSManagedObjectContext(_NestedContextSupport) executeRequest:withContext:error:]_block_invoke + 584
25  CoreData    internalBlockToNSManagedObjectContextPerform + 92
26  libdispatch.dylib   _dispatch_client_callout + 16
27  libdispatch.dylib   _dispatch_barrier_sync_f_invoke + 84
28  CoreData    _perform + 232
29  CoreData    -[NSManagedObjectContext(_NestedContextSupport) executeRequest:withContext:error:] + 188
30 CoreData -[NSManagedObjectContext executeFetchRequest:error:] + 572
31  *MY_APP*    NSManagedObject+MagicalRecord.m line 50__67+[NSManagedObject(MagicalRecord) MR_executeFetchRequest:inContext:]_block_invoke

This happened in the main thread, and I am puzzled by how to debug this. Sounds like a memory issue. Also, when using tools, it shows some leaks in the application when it occurs NSPrivateQueueConcurrencyType.

Look for some ideas on how to nail it.

MagicalRecord Extensively, , . . , , .. , Fetch.

NSPredicate *filterPredicate = [NSPredicate predicateWithFormat:@"code == %@ and pid == %@", aCode,pid];
Permission *aPermission = [Permission MR_findFirstWithPredicate:filterPredicate];
+4
2

( ) , , undefined .
, Managed Object Context NSPrivateQueueConcurrencyType fetch Main Queue. .
MOC NSMainQueueConcurrencyType fetchRequests [MOC performBlock:{...}]

+4

, Core-dateObjectContext managedObject, - , . - , - , / . , , , , - .

0

Source: https://habr.com/ru/post/1669819/


All Articles