Crash en CoreData en –

Una nota, ya he comprobado las siguientes publicaciones 🙁 Problema de desbordamiento de stack 1 Problema de desbordamiento de stack 2

Estoy viendo la siguiente stack de locking en mi aplicación:

2 libsystem_c.dylib 0x32bc87ec _sigtramp + 48 3 CoreData 0x361a2e70 -[NSSQLCore _populateRowForOp:withObject:] + 2716 4 CoreData 0x36194ca2 -[NSSQLCore recordUpdateForObject:] + 130 5 CoreData 0x3619defc -[NSSQLCore recordChangesInContext:] + 600 6 CoreData 0x3619bfae -[NSSQLCore saveChanges:] + 286 7 CoreData 0x360f425e -[NSSQLCore executeRequest:withContext:error:] + 946 8 CoreData 0x360f3336 -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 1130 9 CoreData 0x3615b286 -[NSManagedObjectContext save:] + 522 10 MyCrashingApp 0x000aa040 -[DisplayModelMgr saveDisplayModel:forDate:] (DisplayModelMgr.m:182) 

Esto es sigsegv, así que no se puede atrapar a través de @try .. @ catch. Esto solo ocurre rara vez, así que tengo curiosidad si puede ser una condición de carrera donde se indique en los comentarios entre la eliminación y la adición.

El código para la llamada es:

 - (void) saveDisplayModel:(DisplayModel *)model forDate:(NSDate *)date { if (model == nil || date == nil) return; [log debug:[model description]]; [log debug:@"DMM: saveDisplayModel: %@ lastSyncDate: %@",date, [model lastSyncDate]]; NSFetchRequest *request = [[[NSFetchRequest alloc] init] autorelease]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"MyDisplayModel" inManagedObjectContext:self.context]; NSPnetworkingicate *pnetworkingicate = [NSPnetworkingicate pnetworkingicateWithFormat:@"(requestDate == %@)", date]; [request setPnetworkingicate:pnetworkingicate]; [request setFetchLimit:1]; [request setEntity:entity]; NSError *error = nil; NSArray *mutableFetchResults = [self.context executeFetchRequest:request error:&error]; if (mutableFetchResults != nil) { [log debug:@"DMM: mutableFetchResults:count %i",[mutableFetchResults count]]; NSDate *sDate = [[model.lastSyncDate copy] autorelease]; NSDate *timestamp = [NSDate date]; MyDisplayModel *coreDataModel = nil; if([mutableFetchResults count] > 0) { coreDataModel = [mutableFetchResults objectAtIndex:0]; [coreDataModel setSyncDate:sDate]; [coreDataModel setTimeStamp:timestamp]; [coreDataModel setRequestDate:date]; if(model.entries != nil && [model.entries count] > 0) { for(MyDisplayModelValue *existingVal in coreDataModel.values) { [self.context deleteObject:existingVal]; } } [coreDataModel setValues:nil]; // race condition? } else { coreDataModel = [NSEntityDescription insertNewObjectForEntityForName:@"MyDisplayModel" inManagedObjectContext:self.context]; [coreDataModel setSyncDate:sDate]; [coreDataModel setTimeStamp:timestamp]; [coreDataModel setRequestDate:date]; } for(DisplayModelEntry *dmv in [model.entries allValues]) { MyDisplayModelValue *newDashModelVal = [NSEntityDescription insertNewObjectForEntityForName:@"MyDisplayModelValue" inManagedObjectContext:self.context]; [newDashModelVal setType:[NSNumber numberWithInt:dmv.type]]; [newDashModelVal setActual:[NSNumber numberWithInt:dmv.actual]]; [newDashModelVal setSource:[NSNumber numberWithInt:dmv.source]]; [newDashModelVal setTarget:[NSNumber numberWithInt:dmv.target]]; [newDashModelVal setMymodel:coreDataModel]; [[coreDataModel mutableSetValueForKey:@"values"] addObject:newDashModelVal]; // create new if missing? } NSError *error; if (![self.context save:&error]) { [log error:@"Error Saving Dashbaord Cache: %@",[error description]]; } [self.context refreshObject:coreDataModel mergeChanges:NO]; } 

}

Cualquier orientación en este cálidamente apreciado. Las requestes de comentarios para aclaraciones se responderán rápidamente.