2017-04-13 10 views
1

私はこの不一致で、RestKitのクラッシュを再現するのが難しいです。クラッシュはNSManagedObjectContext::save()RKManagedObjectRequestOperation::saveContextToPersistentStore:failedContext:errorhere's the exact line of code)に発生します。RKManagedObjectRequestOperationのEXC_BREAKPOINT NSManagedObjectContext :: save

このクラッシュは、私たちの生産環境では12人以上の異なるユーザーに起こりましたが、個人的には再現できませんでした。私は、このクラッシュを引き起こしている可能性については何の手がかりも持っていません。私の唯一の手がかりは_forceRegisterLostFaultであり、フォールト/削除されたオブジェクトが関与している可能性があります。

背景:RKManagedObjectRequestOperation::saveContextToPersistentStore:failedContext:errorは、ネットワーク要求後にRestKitマッピングが完了するたびに呼び出されます。

CoreDataでこの特定のEXC_BREAKPOINTを以前に見つけた人はいますか? これに対処する方法の提案はありますか?

スタックトレース:

Crashed: NSManagedObjectContext 0x1741cf5a0 
0 CoreData      0x18add7c7c -[NSManagedObjectContext(_NSInternalAdditions) _forceRegisterLostFault:] + 160 
1 CoreData      0x18ad5c8b0 -[NSManagedObjectContext(_NSInternalAdditions) _validateObjects:forOperation:error:exhaustive:forSave:] + 2884 
2 CoreData      0x18ad5bcf8 -[NSManagedObjectContext(_NSInternalAdditions) _validateChangesForSave:] + 364 
3 CoreData      0x18ad5b94c -[NSManagedObjectContext(_NSInternalChangeProcessing) _prepareForPushChanges:] + 196 
4 CoreData      0x18ad51ec4 -[NSManagedObjectContext save:] + 544 
5 RestKit      0x1013214b8 __84-[RKManagedObjectRequestOperation saveContextToPersistentStore:failedContext:error:]_block_invoke (RKManagedObjectRequestOperation.m:800) 
6 CoreData      0x18add5b70 developerSubmittedBlockToNSManagedObjectContextPerform + 152 
7 libdispatch.dylib    0x1878e91c0 _dispatch_client_callout + 16 
8 libdispatch.dylib    0x1878f6860 _dispatch_barrier_sync_f_invoke + 84 
9 CoreData      0x18add5a80 -[NSManagedObjectContext performBlockAndWait:] + 308 
10 RestKit      0x1013212b8 -[RKManagedObjectRequestOperation saveContextToPersistentStore:failedContext:error:] (RKManagedObjectRequestOperation.m:808) 
11 RestKit      0x1013216d0 -[RKManagedObjectRequestOperation saveContext:error:] (RKManagedObjectRequestOperation.m:831) 
12 RestKit      0x101321f54 -[RKManagedObjectRequestOperation saveContext:] (RKManagedObjectRequestOperation.m:874) 
13 RestKit      0x10131f654 __79-[RKManagedObjectRequestOperation performMappingOnResponseWithCompletionBlock:]_block_invoke.350 (RKManagedObjectRequestOperation.m:660) 
14 RestKit      0x1013534a0 -[RKResponseMapperOperation willFinish] (RKResponseMapperOperation.m:323) 
15 RestKit      0x101353ac4 -[RKResponseMapperOperation main] (RKResponseMapperOperation.m:411) 
16 Foundation      0x1894578c4 -[__NSOperationInternal _start:] + 620 
17 Foundation      0x189524b00 __NSOQSchedule_f + 228 
18 libdispatch.dylib    0x1878e91c0 _dispatch_client_callout + 16 
19 libdispatch.dylib    0x1878f7444 _dispatch_queue_serial_drain + 928 
20 libdispatch.dylib    0x1878ec9a8 _dispatch_queue_invoke + 652 
21 libdispatch.dylib    0x1878f938c _dispatch_root_queue_drain + 572 
22 libdispatch.dylib    0x1878f90ec _dispatch_worker_thread3 + 124 
23 libsystem_pthread.dylib  0x187af22b8 _pthread_wqthread + 1288 
24 libsystem_pthread.dylib  0x187af1da4 start_wqthread + 4 

答えて

0

私は、このエラーのために見てきたいくつかの異なる原因があります。

  • 間違ったスレッドで管理対象オブジェクトおよび/またはコンテキストにアクセスする。 Core Data Concurrency Debuggingを使用して、常に正しいスレッドを使用していることを、-com.apple.CoreData.ConcurrencyDebug 1引数で検証します。
  • 破損したSqliteファイル - あなたのアプリケーションには、すぐに使用できるコアデータストアが含まれていますか?その中のすべてのメタデータが正しいことを確認してください。
  • Overriding the default accessorsをコアデータ管理オブジェクトに追加します。プリミティブ(NSNumberの代わりにintまたはfloat)プロパティを持つオブジェクトがある場合は注意してください。
+0

'-com.apple.CoreData.ConcurrencyDebug 1 'を有効にすると、CoreDataの並行性に関連するRestKit内のいくつかのクラッシュが明らかになります。私は[ここ](https://github.com/RestKit/RestKit/issues/2502)を募集しました。それは私が経験しているクラッシュで何かをしなければならないかどうかは分かりません。これらの並行性の問題は、RestKitの設計の一部であるように見えます。 – 100grams

関連する問題