Obscure assertion crash in com.apple.NSScrollingConcurrentVBLMonitor thread

I have received a few crash reports for my app "Find Any File" with an assertion failure as follows:

assertion failure: "displayTiming != ((void *)0)" -> %lld

Googling this turns up nothing, though.

I wonder if someone has some insight into why this might happen, and how to prevent it.

One reporting user suggests that it happens when my app shows a very long list of items in an NSTableView (>10000 elements).

I have 4 reports from 3 users, and the main thread is doing something related to the table view each time, though not the same (the few other threads are all idle):

Crash 1, in macOS 14.0 (23A344:

Thread 0::  Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib               	       0x182c69400 objc_msgSend + 0
1   AppKit                        	       0x186f15400 -[CALayer(NSViewVisibleRect) NS_viewVisibleRectDidChange] + 40
2   AppKit                        	       0x186900e10 NSViewHierarchyInvalidateVisibleRect + 276
3   AppKit                        	       0x186900db0 NSViewHierarchyInvalidateVisibleRect + 180
4   AppKit                        	       0x186900db0 NSViewHierarchyInvalidateVisibleRect + 180
5   AppKit                        	       0x186900db0 NSViewHierarchyInvalidateVisibleRect + 180
6   AppKit                        	       0x186900db0 NSViewHierarchyInvalidateVisibleRect + 180
7   AppKit                        	       0x186900db0 NSViewHierarchyInvalidateVisibleRect + 180
8   AppKit                        	       0x1869990e0 -[NSView translateOriginToPoint:] + 164
9   AppKit                        	       0x186984108 -[NSClipView _immediateScrollToPoint:] + 420
10  AppKit                        	       0x186983eb8 -[NSClipView scrollToPoint:] + 184
11  AppKit                        	       0x186998d80 -[NSScrollView scrollClipView:toPoint:] + 84
12  AppKit                        	       0x1869448dc -[NSClipView _scrollTo:animateScroll:flashScrollerKnobs:] + 480
13  AppKit                        	       0x186b65b24 __62-[NSScrollingBehaviorConcurrentVBL _stopGestureScrollTracking]_block_invoke + 192
14  AppKit                        	       0x186e6a6e8 ___NSMainRunLoopPerformBlockInModes_block_invoke + 44
15  CoreFoundation                	       0x18310b8c0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 28

Crash 2, in macOS 14.1.1 (23B81):

Thread 0::  Dispatch queue: com.apple.main-thread
0   CoreFoundation                	       0x18ba401f4 DYLD-STUB$$_Block_object_assign + 0
1   libsystem_blocks.dylib        	       0x18b506118 _call_copy_helpers_excp + 80
2   libsystem_blocks.dylib        	       0x18b505c68 _Block_copy + 376
3   libdispatch.dylib             	       0x18b641c7c _dispatch_Block_copy + 32
4   libdispatch.dylib             	       0x18b658df0 _dispatch_source_set_handler + 92
5   CoreFoundation                	       0x18b99e1e4 __CFRunLoopCopyMode + 540
6   CoreFoundation                	       0x18b8b7458 CFRunLoopAddObserver + 220
7   AppKit                        	       0x18f0a687c _PerfAddRunLoopObserver + 192
8   AppKit                        	       0x18f87cd60 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 368
9   AppKit                        	       0x18f323318 -[_NSScrollingConcurrentEventMonitor startMonitoring] + 380
10  AppKit                        	       0x18f321df8 -[NSScrollingBehaviorConcurrentVBL _scrollView:trackGestureScrollWithEvent:] + 884
11  AppKit                        	       0x18f2e67f8 -[NSScrollingBehaviorConcurrentVBL scrollView:scrollWheelWithEvent:] + 512
12  AppKit                        	       0x18f241770 forwardMethod + 252
13  AppKit                        	       0x18f2e62a0 -[NSView scrollWheel:] + 408
14  AppKit                        	       0x18f241770 forwardMethod + 252
15  AppKit                        	       0x18f2e62a0 -[NSView scrollWheel:] + 408
16  AppKit                        	       0x18f241770 forwardMethod + 252
17  AppKit                        	       0x18f2e62a0 -[NSView scrollWheel:] + 408
18  AppKit                        	       0x18f241770 forwardMethod + 252
19  AppKit                        	       0x18f2e62a0 -[NSView scrollWheel:] + 408
20  AppKit                        	       0x18fc45880 -[NSCollectionView scrollWheel:] + 180
21  AppKit                        	       0x18f241770 forwardMethod + 252
22  AppKit                        	       0x18f241770 forwardMethod + 252
23  AppKit                        	       0x18f2e62a0 -[NSView scrollWheel:] + 408
24  AppKit                        	       0x18f241770 forwardMethod + 252
25  AppKit                        	       0x18f2e62a0 -[NSView scrollWheel:] + 408
26  AppKit                        	       0x18f241770 forwardMethod + 252
27  AppKit                        	       0x18f2e62a0 -[NSView scrollWheel:] + 408
28  AppKit                        	       0x18f1d27b0 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 652

As you can see, there's no code of mine involved at the time of crash.

The other (and older) reports are similar, in macOS 13.6.1 and macOS 13.1. All four happened on ARM architecture (which may not be significant due to small number of samples). Memory use of app was not critical (in one case it was about 9 GB total, in others below 4 GB).

The "Binary Images" section only lists Apple libs, apart from my app's. So, there seems to be no 3rd party ext involved.

I've attached a full report as well.

Accepted Reply

I recommend that you file a bug about this. Please post your bug number, just for the record.

The immediate cause of this bug is that AppKit has a subsystem that monitor’s the display’s timing while you’re scrolling (VBL should sound familiar to you!). This subsystem has asked another subsystem for a timer that’s appropriate for the screen that it’s monitoring. That subsystem has return nil, and thus you trap in this assert.

It’s hard to imagine how your code might be causing this, and hence my recommendation above.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Replies

I recommend that you file a bug about this. Please post your bug number, just for the record.

The immediate cause of this bug is that AppKit has a subsystem that monitor’s the display’s timing while you’re scrolling (VBL should sound familiar to you!). This subsystem has asked another subsystem for a timer that’s appropriate for the screen that it’s monitoring. That subsystem has return nil, and thus you trap in this assert.

It’s hard to imagine how your code might be causing this, and hence my recommendation above.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"