Recompiled my app for iOS 9, and I now have the main thread deadlocking with this stack trace:
Thread 1Queue : com.apple.main-thread (serial)
#0 0x00000001148ba136 in __psynch_cvwait ()
#1 0x0000000114882560 in _pthread_cond_wait ()
#2 0x00000001113dd24e in -[__NSOperationInternal _waitUntilFinished:] ()
#3 0x00000001113fe76a in -[NSOperationQueue addOperations:waitUntilFinished:] ()
#4 0x000000010fd76378 in -[FCModelDatabaseQueue execOnSelfSync:] at /Users/david/Projects/MyProject/Pods/FCModel/FCModel/FCModelDatabaseQueue.m:56
#5 0x000000010fd766a5 in -[FCModelDatabaseQueue inDatabase:] at /Users/david/Projects/MyProject/Pods/FCModel/FCModel/FCModelDatabaseQueue.m:76
#6 0x000000010fd65230 in +[FCModel instanceFromDatabaseWithPrimaryKey:] at /Users/david/Projects/MyProject/Pods/FCModel/FCModel/FCModel.m:196
#7 0x000000010fd64888 in +[FCModel instanceWithPrimaryKey:databaseRowValues:createIfNonexistent:] at /Users/david/Projects/MyProject/Pods/FCModel/FCModel/FCModel.m:147
#8 0x000000010fd644a7 in +[FCModel instanceWithPrimaryKey:createIfNonexistent:] at /Users/david/Projects/MyProject/Pods/FCModel/FCModel/FCModel.m:125
#9 0x00000001045a004c in -[MyModel myProperty] at /Users/david/Projects/MyProject/Sources/MyModel.m:593
#10 0x000000010629cfc7 in -[NSObject(NSKeyValueCoding) valueForKey:] ()
#11 0x00000001062b3c3a in -[NSKeyValueNestedProperty object:didAddObservance:recurse:] ()
#12 0x0000000106298a78 in -[NSObject(NSKeyValueObserverRegistration) _addObserver:forProperty:options:context:] ()
#13 0x0000000106298704 in -[NSObject(NSKeyValueObserverRegistration) addObserver:forKeyPath:options:context:] ()
#14 0x000000010463872e in -[ATPDecorator addObserver:forKeyPath:options:context:] at /Users/david/Projects/MyProject/Sources/ATPDecorator.m:129
And the FCModelDatabaseQueue is deadlocked with this stack trace (much less useful to me):
Thread 4Queue : FCModelDatabaseQueue :: NSOperation 0x7f994b5d9690 (QOS: UTILITY) (serial)
#0 0x00000001148ba166 in __psynch_mutexwait ()
#1 0x000000011487f696 in _pthread_mutex_lock ()
#2 0x000000011137f238 in -[NSObject(NSKeyValueObservingPrivate) _changeValueForKey:key:key:usingBlock:] ()
#3 0x0000000111381564 in -[__NSOperationInternal _start:] ()
#4 0x00000001113811f7 in __NSOQSchedule_f ()
#5 0x00000001145394bb in _dispatch_client_callout ()
#6 0x000000011451fa3c in _dispatch_queue_drain ()
#7 0x000000011451ef5d in _dispatch_queue_invoke ()
#8 0x0000000114521ba6 in _dispatch_root_queue_drain ()
#9 0x0000000114521615 in _dispatch_worker_thread3 ()
#10 0x0000000114881a9d in _pthread_wqthread ()
#11 0x000000011487f3dd in start_wqthread ()
The problem seems similar to the one I had a while back #42 when initWithFieldValues:existsInDatabaseAlready: listened to modifications using KVO. I'm saying that because the queue's waiting in a _changeValueForKey:key:key:usingBlock: method and the main thread is in a addObserver:forKeyPath:options:context: call.
What I don't understand is why the queue thread is waiting even before the block added to FCModelDatabaseQueue is called. I differ the assembler of _changeValueForKey:key:key:usingBlock: and it has heavily changed between iOS 8 and iOS 9, with some locking method calls removed.
BUT, I can't seem to reproduce the problem in a test project.
Recompiled my app for iOS 9, and I now have the main thread deadlocking with this stack trace:
And the FCModelDatabaseQueue is deadlocked with this stack trace (much less useful to me):
The problem seems similar to the one I had a while back #42 when
initWithFieldValues:existsInDatabaseAlready:
listened to modifications using KVO. I'm saying that because the queue's waiting in a_changeValueForKey:key:key:usingBlock:
method and the main thread is in aaddObserver:forKeyPath:options:context:
call.What I don't understand is why the queue thread is waiting even before the block added to
FCModelDatabaseQueue
is called. I differ the assembler of_changeValueForKey:key:key:usingBlock:
and it has heavily changed between iOS 8 and iOS 9, with some locking method calls removed.BUT, I can't seem to reproduce the problem in a test project.