Поскольку macOS приложение Catalina Xcode каждую ночь падает, за исключением CVCGDisplayLink - PullRequest
0 голосов
/ 01 апреля 2020

У меня есть приложение macOS с GUI, которое работает 24/7 и на прошлой неделе работало безупречно. Три дня go Я обновил свой Ma c mini в конце 2012 года до macOS Catalina. Я снова запустил свое приложение, и оно заработало. На следующее утро я столкнулся с ошибкой EXC_BAD_ACCESS, которая вызвала сбой приложения (дополнительную информацию см. Ниже). Перезапустил приложение, ошибка снова появилась на следующее утро и сегодня утром.

Справочная информация. Я не ожидаю, что аппаратное обеспечение будет иметь какое-либо влияние, поскольку оно никогда не было проблемой, но все же: у меня есть подключенный дисплей, который через подключенная вилка отключается ночью и снова включается утром.

Вот ошибка:

CVDisplayLink (989): EXC_BAD_ACCESS (code=1, address=0x40)

В журнале перед cra sh это сообщение появляется примерно 50 раз , не уверен, имеет ли это какое-либо отношение к самому cra sh:

CVCGDisplayLink::setCurrentDisplay didn't find a valid display - falling back to 60Hz

и

Could not start the display link: -6661

Я прикрепил скриншот с обсуждаемыми потоками и последними командами. Я не нахожу никакой связи с моим кодом ... Приложение всегда падает в одном и том же месте (я думаю).

enter image description here

Любая помощь высоко ценится! Мой следующий шаг - оставить дисплей включенным на ночь и посмотреть, появится ли ошибка снова. Даже если нет, это не решение, поскольку я хочу, чтобы дисплей спал ночью и в другое время ...

Вот отчет о sh:

Process:               FIPS [29505]
Path:                  /Applications/FIPS.app/Contents/MacOS/FIPS
Identifier:            xxx.xxxxxxxx.FIPS
Version:               1.0 (1)
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           FIPS [29505]
User ID:               502

Date/Time:             2020-03-29 23:28:13.101 +0200
OS Version:            Mac OS X 10.15.4 (19E266)
Report Version:        12
Anonymous UUID:        571E7574-0586-B5D1-F56D-FDC0D2261660


Time Awake Since Boot: 86000 seconds

System Integrity Protection: enabled

Crashed Thread:        17  CVDisplayLink

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000040
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [29505]

VM Regions Near 0x40:
--> 
    __TEXT                 000000010510d000-000000010517f000 [  456K] r-x/r-x SM=COW  /Applications/FIPS.app/Contents/MacOS/FIPS

Thread 0:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib          0x00007fff6f55fdfa mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff6f560170 mach_msg + 60
2   com.apple.SkyLight              0x00007fff646fa418 SLSCopyManagedDisplayForSpace + 225
3   com.apple.AppKit                0x00007fff329ccc68 _NSDisplayUUIDForSpace + 42
4   com.apple.AppKit                0x00007fff33137f50 -[_NSFullScreenSpace screen] + 47
5   com.apple.AppKit                0x00007fff326a4b7e +[_NSFullScreenSpace visibleFullScreenSpaceOnScreen:] + 312
6   com.apple.AppKit                0x00007fff326a49fa -[NSScreen _menuBarHeight] + 76
7   com.apple.AppKit                0x00007fff326a4998 -[NSScreen _layoutFrame] + 71
8   com.apple.AppKit                0x00007fff326e314a -[NSScreen visibleFrame] + 44
9   com.apple.AppKit                0x00007fff326e23b6 -[NSWindow(NSWindowResizing) _resizableEdgesForGrowing:shrinking:] + 587
10  com.apple.AppKit                0x00007fff3287100b -[NSWindow(NSWindowResizing) _resizeDirectionForMouseLocation:] + 225
11  com.apple.AppKit                0x00007fff32870e86 -[NSWindow(NSWindowResizing) _edgeResizingCursorUpdate:atLocation:] + 227
12  com.apple.AppKit                0x00007fff32870a22 -[NSWindow(NSCursorRects) _setCursorForMouseLocation:] + 179
13  com.apple.AppKit                0x00007fff32781599 _NSWindowDisplayCycleUpdateStructuralRegions + 571
14  com.apple.AppKit                0x00007fff3277bcc4 __NSWindowGetDisplayCycleObserverForUpdateStructuralRegions_block_invoke + 420
15  com.apple.AppKit                0x00007fff32773e52 NSDisplayCycleObserverInvoke + 155
16  com.apple.AppKit                0x00007fff327739dc NSDisplayCycleFlush + 937
17  com.apple.QuartzCore            0x00007fff40f07454 CA::Transaction::run_commit_handlers(CATransactionPhase) + 106
18  com.apple.QuartzCore            0x00007fff40f06166 CA::Transaction::commit() + 230
19  com.apple.AppKit                0x00007fff3282fa01 __62+[CATransaction(NSCATransaction) NS_setFlushesWithDisplayLink]_block_invoke + 266
20  com.apple.AppKit                0x00007fff32f4e950 ___NSRunLoopObserverCreateWithHandler_block_invoke + 41
21  com.apple.CoreFoundation        0x00007fff3542402c __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
22  com.apple.CoreFoundation        0x00007fff35423f5c __CFRunLoopDoObservers + 457
23  com.apple.CoreFoundation        0x00007fff354234f4 __CFRunLoopRun + 884
24  com.apple.CoreFoundation        0x00007fff35422b23 CFRunLoopRunSpecific + 466
25  com.apple.HIToolbox             0x00007fff34044abd RunCurrentEventLoopInMode + 292
26  com.apple.HIToolbox             0x00007fff340447d5 ReceiveNextEventCommon + 584
27  com.apple.HIToolbox             0x00007fff34044579 _BlockUntilNextEventMatchingListInModeWithFilter + 64
28  com.apple.AppKit                0x00007fff3268fc99 _DPSNextEvent + 883
29  com.apple.AppKit                0x00007fff3268e4e0 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1352
30  com.apple.AppKit                0x00007fff326801ee -[NSApplication run] + 658
31  com.apple.AppKit                0x00007fff32651ff6 NSApplicationMain + 777
32  xxx.xxxxxxx.FIPS                0x000000010510fb49 main + 9 (AppDelegate.swift:12)
33  libdyld.dylib                   0x00007fff6f41ecc9 start + 1

Thread 1:: JavaScriptCore bmalloc scavenger
0   libsystem_kernel.dylib          0x00007fff6f562882 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00007fff6f627425 _pthread_cond_wait + 698
2   libc++.1.dylib                  0x00007fff6c6fa623 std::__1::condition_variable::__do_timed_wait(std::__1::unique_lock<std::__1::mutex>&, std::__1::chrono::time_point<std::__1::chrono::system_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > >) + 93
3   com.apple.JavaScriptCore        0x00007fff39c42a75 bmalloc::Scavenger::threadRunLoop() + 741
4   com.apple.JavaScriptCore        0x00007fff39c42489 bmalloc::Scavenger::threadEntryPoint(bmalloc::Scavenger*) + 9
5   com.apple.JavaScriptCore        0x00007fff39c44b67 void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(bmalloc::Scavenger*), bmalloc::Scavenger*> >(void*) + 39
6   libsystem_pthread.dylib         0x00007fff6f627109 _pthread_start + 148
7   libsystem_pthread.dylib         0x00007fff6f622b8b thread_start + 15

Thread 2:: com.apple.NSURLConnectionLoader
0   libsystem_kernel.dylib          0x00007fff6f55fdfa mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff6f560170 mach_msg + 60
2   com.apple.CoreFoundation        0x00007fff35424bf7 __CFRunLoopServiceMachPort + 247
3   com.apple.CoreFoundation        0x00007fff354236b1 __CFRunLoopRun + 1329
4   com.apple.CoreFoundation        0x00007fff35422b23 CFRunLoopRunSpecific + 466
5   com.apple.CFNetwork             0x00007fff33c5009a 0x7fff33c06000 + 303258
6   com.apple.Foundation            0x00007fff37ad1882 __NSThread__start__ + 1064
7   libsystem_pthread.dylib         0x00007fff6f627109 _pthread_start + 148
8   libsystem_pthread.dylib         0x00007fff6f622b8b thread_start + 15

Thread 3:: com.apple.NSEventThread
0   libsystem_kernel.dylib          0x00007fff6f55fdfa mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff6f560170 mach_msg + 60
2   com.apple.SkyLight              0x00007fff645a58d7 CGSSnarfAndDispatchDatagrams + 237
3   com.apple.SkyLight              0x00007fff647d55a5 SLSGetNextEventRecordInternal + 83
4   com.apple.SkyLight              0x00007fff64673fbe SLEventCreateNextEvent + 136
5   com.apple.HIToolbox             0x00007fff34051da6 PullEventsFromWindowServerOnConnection(unsigned int, unsigned char, __CFMachPortBoost*) + 268
6   com.apple.HIToolbox             0x00007fff34051c72 MessageHandler(__CFMachPort*, void*, long, void*) + 48
7   com.apple.CoreFoundation        0x00007fff35453983 __CFMachPortPerform + 250
8   com.apple.CoreFoundation        0x00007fff35425003 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41
9   com.apple.CoreFoundation        0x00007fff35424f52 __CFRunLoopDoSource1 + 541
10  com.apple.CoreFoundation        0x00007fff35423a6c __CFRunLoopRun + 2284
11  com.apple.CoreFoundation        0x00007fff35422b23 CFRunLoopRunSpecific + 466
12  com.apple.AppKit                0x00007fff328315b4 _NSEventThread + 132
13  libsystem_pthread.dylib         0x00007fff6f627109 _pthread_start + 148
14  libsystem_pthread.dylib         0x00007fff6f622b8b thread_start + 15

Thread 4:: com.apple.coreanimation.render-server
0   libsystem_kernel.dylib          0x00007fff6f55fdfa mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff6f560170 mach_msg + 60
2   com.apple.QuartzCore            0x00007fff40f4f1c2 CA::Render::Server::server_thread(void*) + 496
3   com.apple.QuartzCore            0x00007fff40f4efc3 thread_fun(void*) + 25
4   libsystem_pthread.dylib         0x00007fff6f627109 _pthread_start + 148
5   libsystem_pthread.dylib         0x00007fff6f622b8b thread_start + 15

Thread 5:: com.apple.coreaudio.AQClient
0   libsystem_kernel.dylib          0x00007fff6f55fdfa mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff6f560170 mach_msg + 60
2   com.apple.CoreFoundation        0x00007fff35424bf7 __CFRunLoopServiceMachPort + 247
3   com.apple.CoreFoundation        0x00007fff354236b1 __CFRunLoopRun + 1329
4   com.apple.CoreFoundation        0x00007fff35422b23 CFRunLoopRunSpecific + 466
5   com.apple.audio.toolbox.AudioToolbox    0x00007fff337a44cc GenericRunLoopThread::Entry(void*) + 166
6   libAudioToolboxUtility.dylib    0x00007fff6bda96c9 CAPThread::Entry(CAPThread*) + 77
7   libsystem_pthread.dylib         0x00007fff6f627109 _pthread_start + 148
8   libsystem_pthread.dylib         0x00007fff6f622b8b thread_start + 15

Thread 6:
0   libsystem_kernel.dylib          0x00007fff6f55fe36 semaphore_wait_trap + 10
1   com.apple.audio.caulk           0x00007fff68f6ab16 caulk::mach::semaphore::wait() + 16
2   com.apple.audio.caulk           0x00007fff68f6a9b2 caulk::semaphore::timed_wait(double) + 106
3   com.apple.audio.caulk           0x00007fff68f6a7c4 caulk::concurrent::details::worker_thread::run() + 30
4   com.apple.audio.caulk           0x00007fff68f6a1e4 void* caulk::thread_proxy<std::__1::tuple<caulk::thread::attributes, void (caulk::concurrent::details::worker_thread::*)(), std::__1::tuple<caulk::concurrent::details::worker_thread*> > >(void*) + 45
5   libsystem_pthread.dylib         0x00007fff6f627109 _pthread_start + 148
6   libsystem_pthread.dylib         0x00007fff6f622b8b thread_start + 15

Thread 7:: AMCP Logging Spool
0   libsystem_kernel.dylib          0x00007fff6f55fe36 semaphore_wait_trap + 10
1   com.apple.audio.caulk           0x00007fff68f6ab16 caulk::mach::semaphore::wait() + 16
2   com.apple.audio.caulk           0x00007fff68f6a9b2 caulk::semaphore::timed_wait(double) + 106
3   com.apple.audio.caulk           0x00007fff68f6a7c4 caulk::concurrent::details::worker_thread::run() + 30
4   com.apple.audio.caulk           0x00007fff68f6a1e4 void* caulk::thread_proxy<std::__1::tuple<caulk::thread::attributes, void (caulk::concurrent::details::worker_thread::*)(), std::__1::tuple<caulk::concurrent::details::worker_thread*> > >(void*) + 45
5   libsystem_pthread.dylib         0x00007fff6f627109 _pthread_start + 148
6   libsystem_pthread.dylib         0x00007fff6f622b8b thread_start + 15

Thread 8:
0   libsystem_pthread.dylib         0x00007fff6f622b68 start_wqthread + 0

Thread 9:
0   libsystem_pthread.dylib         0x00007fff6f622b68 start_wqthread + 0

Thread 10:
0   libsystem_pthread.dylib         0x00007fff6f622b68 start_wqthread + 0

Thread 11:
0   libsystem_pthread.dylib         0x00007fff6f622b68 start_wqthread + 0

Thread 12:
0   libsystem_pthread.dylib         0x00007fff6f622b68 start_wqthread + 0

Thread 13:
0   libsystem_pthread.dylib         0x00007fff6f622b68 start_wqthread + 0

Thread 14:
0   libsystem_pthread.dylib         0x00007fff6f622b68 start_wqthread + 0

Thread 15:: CVDisplayLink
0   libsystem_kernel.dylib          0x00007fff6f562882 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00007fff6f627457 _pthread_cond_wait + 748
2   com.apple.CoreVideo             0x00007fff373d7d2b CVDisplayLink::waitUntil(unsigned long long) + 229
3   com.apple.CoreVideo             0x00007fff373d7238 CVDisplayLink::runIOThread() + 482
4   libsystem_pthread.dylib         0x00007fff6f627109 _pthread_start + 148
5   libsystem_pthread.dylib         0x00007fff6f622b8b thread_start + 15

Thread 16:: CVDisplayLink
0   libsystem_kernel.dylib          0x00007fff6f562882 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00007fff6f627457 _pthread_cond_wait + 748
2   com.apple.CoreVideo             0x00007fff373d7d2b CVDisplayLink::waitUntil(unsigned long long) + 229
3   com.apple.CoreVideo             0x00007fff373d7238 CVDisplayLink::runIOThread() + 482
4   libsystem_pthread.dylib         0x00007fff6f627109 _pthread_start + 148
5   libsystem_pthread.dylib         0x00007fff6f622b8b thread_start + 15

Thread 17 Crashed:: CVDisplayLink
0   com.apple.CoreVideo             0x00007fff373d76ab CVCGDisplayLink::getDisplayTimes(unsigned long long*, unsigned long long*, unsigned long long*) + 65
1   com.apple.CoreVideo             0x00007fff373d7525 CVHWTime::update(double, bool*, bool*) + 57
2   com.apple.CoreVideo             0x00007fff373d73de CVXTime::update() + 44
3   com.apple.CoreVideo             0x00007fff373d711c CVDisplayLink::runIOThread() + 198
4   libsystem_pthread.dylib         0x00007fff6f627109 _pthread_start + 148
5   libsystem_pthread.dylib         0x00007fff6f622b8b thread_start + 15

Thread 17 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000000  rbx: 0x0000600001d56c38  rcx: 0x00007000060c8da8  rdx: 0x00007000060c8db0
  rdi: 0x00007f9e1d18fe20  rsi: 0x00007000060c8db8  rbp: 0x00007000060c8d90  rsp: 0x00007000060c8d60
   r8: 0x000000000009ad1d   r9: 0x00007f9e1d18fe50  r10: 0x00007f9e1d18fe58  r11: 0x0000000000000206
  r12: 0x00007000060c8db8  r13: 0x0000000000000000  r14: 0x00007000060c8e07  r15: 0x00007000060c8db0
  rip: 0x00007fff373d76ab  rfl: 0x0000000000010246  cr2: 0x0000000000000000

Logical CPU:     0
Error Code:      0x00000000
Trap Number:     0

За ним следуют миллионы строк двоичных изображений, за которыми следуют:

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 54
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 16801343
    thread_create: 0
    thread_set_state: 967

VM Region Summary:
ReadOnly portion of Libraries: Total=778.7M resident=0K(0%) swapped_out_or_unallocated=778.7M(100%)
Writable regions: Total=758.5M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=758.5M(100%)

                                VIRTUAL   REGION 
REGION TYPE                        SIZE    COUNT (non-coalesced) 
===========                     =======  ======= 
Accelerate framework              1024K        8 
Activity Tracing                   256K        1 
CG backing stores                  440K        2 
CG image                            52K        9 
CoreAnimation                     2940K      146 
CoreData Object IDs               4100K        2 
CoreGraphics                         8K        1 
CoreImage                           12K        3 
CoreUI image data                  392K        7 
Foundation                         956K        5 
IOKit                             7940K        1 
Image IO                          8188K       32 
Kernel Alloc Once                    8K        1 
MALLOC                           593.3M      211 
MALLOC guard page                   48K       11 
MALLOC_NANO (reserved)           128.0M        1         reserved VM address space (unallocated)
Memory Tag 242                      12K        1 
Memory Tag 251                      16K        1 
SQLite page cache                   64K        1 
STACK GUARD                       56.1M       18 
Stack                             17.1M       18 
VM_ALLOCATE                        412K       28 
WebKit Malloc                     8604K       18 
__DATA                            55.1M      502 
__DATA_CONST                       637K       21 
__FONT_DATA                          4K        1 
__GLSLBUILTINS                    5176K        1 
__LINKEDIT                       392.2M       17 
__OBJC_RO                         32.2M        1 
__OBJC_RW                         1892K        2 
__TEXT                           386.5M      487 
__UNICODE                          564K        1 
libnetwork                        1664K       24 
mapped file                      378.0M       74 
shared memory                      668K       18 
===========                     =======  ======= 
TOTAL                              2.0G     1675 
TOTAL, minus reserved VM space     1.9G     1675

После добавления символической c точки останова в getDisplayTimes с помощью bt и перезапуска приложения код немедленно останавливается, чтобы показать эту ситуацию:

Журнал:

* thread #17, name = 'CVDisplayLink', stop reason = breakpoint 1.1
  * frame #0: 0x00007fff3910a66a CoreVideo`CVCGDisplayLink::getDisplayTimes(unsigned long long*, unsigned long long*, unsigned long long*)
    frame #1: 0x00007fff3910a525 CoreVideo`CVHWTime::update(double, bool*, bool*) + 57
    frame #2: 0x00007fff3910a3de CoreVideo`CVXTime::update() + 44
    frame #3: 0x00007fff3910a11c CoreVideo`CVDisplayLink::runIOThread() + 198
    frame #4: 0x0000000101047c65 libsystem_pthread.dylib`_pthread_start + 148
    frame #5: 0x00000001010434af libsystem_pthread.dylib`thread_start + 15

и это:

enter image description here

...