Core Data: _PFExternalReferenceData raises NSInvalidArgumentException

Originator:indragiek
Number:rdar://10635274 Date Originated:02-Jan-2012 08:21 PM
Status:Open Resolved:
Product:Mac OS X SDK Product Version:10.7.2 (11C74)
Classification:Serious Bug Reproducible:Rarely
 
Summary:

Accessing _PFExternalReferenceData from a background queue randomly results in an NSInvalidArgumentException being raised. 

Steps to Reproduce:

Access and use a binary data property of a managed object that has external storage enabled in a background GCD queue.

Expected Results:

No problems.

Actual Results:

NSInvalidArgumentException is raised and the app crashes.

Regression:

Can not replicate consistently. I'm not even positive of whether it's the dispatch queue that is causing the problem, it is difficult to test because this problem can hardly be replicated.

Notes:

Exception log:

Application Specific Information:
objc[36029]: garbage collection is OFF
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unable to open file with path: /private/var/folders/8z/8tgv57z13lsd9pj0n349kf700000gn/T/TemporaryItems/(A Document Being Saved By Sonora 29)/BA5EAB55-3839-403A-A421-1178753F59D9 (2)'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff86635286 __exceptionPreprocess + 198
	1   libobjc.A.dylib                     0x00007fff88c40d5e objc_exception_throw + 43
	2   CoreData                            0x00007fff8d416493 +[_PFRoutines readExternalReferenceDataFromFile:] + 339
	3   CoreData                            0x00007fff8d49a461 -[_PFExternalReferenceData _retrieveExternalData] + 177
	4   CoreData                            0x00007fff8d499a12 -[_PFExternalReferenceData bytes] + 18
	5   CoreFoundation                      0x00007fff865a7cf6 CFDataGetBytePtr + 118
	6   CoreGraphics                        0x00007fff85ca1892 CGDataProviderCreateWithCFData + 140
	7   Sonora                              0x000000010692d5f3 SNRCGImageWithJPEGData + 51
	8   Sonora                              0x000000010692cec8 -[SNRMix(Additions) setDynamicallyGeneratedArtwork] + 2008
	9   Sonora                              0x000000010692bf8f -[SNRMix(Additions) observeValueForKeyPath:ofObject:change:context:] + 463
	10  Foundation                          0x00007fff8906f862 NSKeyValueNotifyObserver + 387
	11  Foundation                          0x00007fff8909099b NSKeyValueDidChange + 486
	12  Foundation                          0x00007fff8903d0fb -[NSObject(NSKeyValueObserverNotification) didChangeValueForKey:] + 130
	13  CoreData                            0x00007fff8d3afc57 _PF_ManagedObject_DidChangeValueForKeyIndex + 103
	14  CoreData                            0x00007fff8d3af178 _sharedIMPL_setvfk_core + 264
	15  Sonora                              0x0000000106928a52 -[SNRiTunesImportOperation main] + 4418
	16  Foundation                          0x00007fff8906e788 -[__NSOperationInternal start] + 705
	17  Foundation                          0x00007fff890819e6 ____NSOQSchedule_block_invoke_2 + 124
	18  libdispatch.dylib                   0x00007fff8dd418ba _dispatch_call_block_and_release + 18
	19  libdispatch.dylib                   0x00007fff8dd42799 _dispatch_worker_thread2 + 255
	20  libsystem_c.dylib                   0x00007fff894043da _pthread_wqthread + 316
	21  libsystem_c.dylib                   0x00007fff89405b85 start_wqthread + 13
)

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!