My iOS app is using GLKViewController to display data received from an external camera streaming on a local network. However, after a few hours it hangs and the app becomes not responsive. If I pause the execution on the debugger, I can see that the app is actually running (network threads for instance are alive) but the Update and DrawInRect methods are not being fired and the main thread seems to be stuck.
In particular, backtracing threads produces this output as far as gpu related threads are concerned:
thread #1, queue = 'gputools.DYSharedMemoryTransport.0x102d00000.send', stop reason = instruction step over
* frame #0: 0x00000001f88c559c libsystem_c.dylib`nanosleep + 160
frame #1: 0x00000001f88c54a4 libsystem_c.dylib`usleep + 64
frame #2: 0x0000000102933780 GPUToolsCore`-[DYSharedMemoryTransport _waitEAGAIN] + 40
frame #3: 0x0000000102957510 GPUToolsCore`-[DYBaseStreamTransport _writeBuffers:] + 232
frame #4: 0x0000000102957b00 GPUToolsCore`-[DYBaseStreamTransport _sendMessage:error:] + 508
frame #5: 0x0000000102946064 GPUToolsCore`__63-[DYTransport send:inReplyTo:error:replyQueue:timeout:handler:]_block_invoke.223 + 116
frame #6: 0x0000000102314de4 libdispatch.dylib`_dispatch_client_callout + 16
frame #7: 0x0000000102323d18 libdispatch.dylib`_dispatch_sync_invoke_and_complete_recurse + 132
frame #8: 0x0000000102945e38 GPUToolsCore`-[DYTransport send:inReplyTo:error:replyQueue:timeout:handler:] + 644
frame #9: 0x0000000102932530 GPUToolsCore`-[DYSharedMemoryTransport send:inReplyTo:error:replyQueue:timeout:handler:] + 252
frame #10: 0x00000001024a5120 libglInterpose.dylib`handle_frame_boundary + 472
frame #11: 0x00000001026917a0 libglInterpose.dylib`_EAGLContext_PresentInterposeCommon(EAGLContext*, unsigned int, unsigned long, double, bool () block_pointer) + 988
frame #12: 0x000000010268f074 libglInterpose.dylib`EAGLContext_presentRenderbuffer(EAGLContext*, objc_selector*, unsigned long) + 80
frame #13: 0x0000000205f8192c GLKit`-[GLKView _display:] + 308
frame #14: 0x0000000205f82b08 GLKit`-[GLKViewController _updateAndDraw] + 520
frame #15: 0x000000010293d66c GPUToolsCore`-[DYDisplayLinkInterposer forwardDisplayLinkCallback:] + 176
frame #16: 0x00000001fd270574 QuartzCore`CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 828
frame #17: 0x00000001f901a58c IOKit`IODispatchCalloutFromCFMessage + 488
frame #18: 0x00000001f8d223e4 CoreFoundation`__CFMachPortPerform + 188
frame #19: 0x00000001f8d49c30 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56
frame #20: 0x00000001f8d4937c CoreFoundation`__CFRunLoopDoSource1 + 440
frame #21: 0x00000001f8d44134 CoreFoundation`__CFRunLoopRun + 2140
frame #22: 0x00000001f8d435b8 CoreFoundation`CFRunLoopRunSpecific + 436
frame #23: 0x00000001fafb7584 GraphicsServices`GSEventRunModal + 100
frame #24: 0x0000000225383558 UIKitCore`UIApplicationMain + 212
frame #25: 0x0000000100471798 KiberField`main(argc=1, argv=0x000000016f9f7780) at main.m:14:16
frame #26: 0x00000001f8803b94 libdyld.dylib`start + 4
thread #2, name = 'gputools.smt_poll.0x281b4a8a0'
frame #0: 0x00000001f8950428 libsystem_kernel.dylib`__semwait_signal + 8
frame #1: 0x00000001f88c55d0 libsystem_c.dylib`nanosleep + 212
frame #2: 0x00000001f88c54a4 libsystem_c.dylib`usleep + 64
frame #3: 0x0000000102932df4 GPUToolsCore`smt_poll_thread_entry(void*) + 136
frame #4: 0x00000001f89d42fc libsystem_pthread.dylib`_pthread_body + 128
frame #5: 0x00000001f89d425c libsystem_pthread.dylib`_pthread_start + 48
frame #6: 0x00000001f89d7d08 libsystem_pthread.dylib`thread_start + 4
thread #3, name = 'gputools.smt_poll.0x281b58ce0'
frame #0: 0x00000001f8950428 libsystem_kernel.dylib`__semwait_signal + 8
frame #1: 0x00000001f88c55d0 libsystem_c.dylib`nanosleep + 212
frame #2: 0x00000001f88c54a4 libsystem_c.dylib`usleep + 64
frame #3: 0x0000000102932df4 GPUToolsCore`smt_poll_thread_entry(void*) + 136
frame #4: 0x00000001f89d42fc libsystem_pthread.dylib`_pthread_body + 128
frame #5: 0x00000001f89d425c libsystem_pthread.dylib`_pthread_start + 48
frame #6: 0x00000001f89d7d08 libsystem_pthread.dylib`thread_start + 4
My question is: what could be possibly blocking the thread? Alternatively, I can detect this deadlock with a timeout timer checked in another thread: is there a way to unblock the graphical thread (for instance manually calling Update or whatever else) ?