几个小时后GLKViewController挂起

时间:2019-10-03 08:23:01

标签: ios opengl-es

我的iOS应用正在使用GLKViewController来显示从本地网络上流式传输的外部摄像机接收到的数据。但是,几个小时后挂起,应用程序没有响应。如果我在调试器上暂停执行,则可以看到该应用程序实际上正在运行(例如,网络线程处于活动状态),但未触发Update和DrawInRect方法,主线程似乎被卡住了。

特别是,就涉及gpu相关的线程而言,回溯线程会产生此输出:


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

我的问题是:什么可能阻塞线程? 另外,我可以通过在另一个线程中检查超时计时器来检测此死锁:是否有办法解除图形线程的阻塞(例如,手动调用Update或其他方法)?

1 个答案:

答案 0 :(得分:0)

我也遇到了这个问题。我在webrtc中使用了'RTCEAGLVideoView'来显示视频图像。主线程似乎不再占用CPU时间!这可能是iPadOS 13中的错误吗?