Recently when I was doing some performance fixes for an iOS app I am working on, I came across a strange issue. The app UI would freeze indefinitely without causing a crash or hitting a breakpoint. This freeze was intermittent, which made things difficult. Initially I suspected a deadlock in some new code, but I had not introduced any explicit @synchronized or semaphore wait statements in the code <which generally cause deadlocks>. All I had done is moved JSON response parsing code to a shared background queue.
On the debugger, hitting the pause button showed me that the execution was stuck in [pmutex wait] method. Quick googling of this gave me the answer I was looking for.
Cause
What had happened was that I was using Core Data abstraction for database storage and I had made a singleton class for all database methods (seems like a bad idea now). Continue reading “iOS/Cocoa : Resolving deadlock caused by core data multi threading” »
Incoming search terms:
- iOS what happen when deadlock raise (8)
- how to create multiple context in coredata in ios (2)
- multiple thread core data (2)
- save exception coredata deadlock (1)
- ios deadlocks (1)
- ios debug deadlock (1)
- ios objective c article on multithreading (1)
- ios perform fetch deadlock (1)
- iOS perform UI operation wait display done (1)
- thread safe (1)