Sudden error being logged continuously in XCode console

I've an app I've been working on for quite some time now. It uses SpriteKit. The windows with the scenes in them are generated programmatically. All of a sudden, when it's up and running through XCode, the console throws out a continuous stream of errors - probably in the order of 1 per second. The main one that makes up this stream is:

2022-03-07 20:07:38.765930+0000 My*App[8461:465673] [] CurrentVBLDelta returned 0 for display 1 -- ignoring unreasonable value

But others that appear slightly less frequently are:

2022-03-07 20:07:38.447800+0000 My*App[8461:465143] Metal GPU Frame Capture Enabled 2022-03-07 20:07:38.448070+0000 My*App[8461:465143] Metal API Validation Enabled 2022-03-07 20:07:38.613097+0000 My*App[8461:465640] [] [0x7f9596053820] CVCGDisplayLink::setCurrentDisplay: 1 2022-03-07 20:07:38.613415+0000 My*App[8461:465640] [] [0x7f9596053820] Bad CurrentVBLDelta for display 1 is zero. defaulting to 60Hz. 2022-03-07 20:07:38.613442+0000 My*App[8461:465640] [] [0x7f9596053800] CVDisplayLinkCreateWithCGDisplays count: 1 [displayID[0]: 0x1] [CVCGDisplayLink: 0x7f9596053820] 2022-03-07 20:07:38.613467+0000 My*App[8461:465640] [] [0x7f9596053800] CVDisplayLinkStart 2022-03-07 20:07:38.613487+0000 My*App[8461:465640] [] [0x7f9596053820] CVDisplayLink::start 2022-03-07 20:07:38.613541+0000 My*App[8461:465640] [] [0x7f9596053800] CVDisplayLinkStart 2022-03-07 20:07:38.613575+0000 My*App[8461:465640] [] [0x7f9596053820] CVDisplayLink::start 2022-03-07 20:07:38.613634+0000 My*App[8461:465671] [] [0x600000c09f10] CVXTime::reset 2022-03-07 20:07:38.613718+0000 My*App[8461:465671] [] CurrentVBLDelta returned 0 for display 1 -- ignoring unreasonable value 2022-03-07 20:07:38.639810+0000 My*App[8461:465671] [] CurrentVBLDelta returned 0 for display 1 -- ignoring unreasonable value 2022-03-07 20:07:38.639887+0000 My*App[8461:465671] [] [0x7f9596053820] CVCGDisplayLink::getDisplayTimes display: 1 -- SLSDisplayGetCurrentVBLDelta returned 0 => generating fake times 2022-03-07 20:07:38.673702+0000 My*App[8461:465653] [] [0x7f9596053820] CVCGDisplayLink::setCurrentDisplay: 1 2022-03-07 20:07:38.673748+0000 My*App[8461:465653] [] [0x7f9596053820] CVDisplayLink::stop 2022-03-07 20:07:38.673862+0000 My*App[8461:465653] [] [0x7f9596053820] Bad CurrentVBLDelta for display 1 is zero. defaulting to 60Hz. 2022-03-07 20:07:38.673883+0000 My*App[8461:465653] [] [0x7f9596053820] CVDisplayLink::start

I really don't know how else to describe this. I can only imagine having to hand over the entire project as lately I've only been working on the storyboard file so how would this affect it? To be honest the only change I can see is my upgrade to OSX 12.2.1. It's definitely something to do with SpriteKit since not initialising a window with a scene in it stops the errors from showing.

Same here. I also updated to macOS 12.2.1 a couple of days ago. I'm not using SpriteKit but I do use Metal API.

Did you make any progress with this? I'm seeing this -- much more frequently than once per second -- working in our MacOS app in XCode 13. It's debilitating, as you literally can't do anything in XCode, or the app, while that's going on. I'm also on 12.2.1, with an M1 MBP.

I get lines like this in my Xcode console about 60 times per second:

2022-03-25 00:11:16.667813-0700 MyApp[22325:1916761] [] CurrentVBLDelta returned 0 for display 5 -- ignoring unreasonable value
2022-03-25 00:11:16.668092-0700 MyApp[22325:1916761] [] [0x7f82f48a2a20] Bad CurrentVBLDelta for display 5 is zero. defaulting to 60Hz.

This is apparently a new bug in CVDisplayLink or connected code. I'm running Monterrey 12.3 on a new MacBook Pro 14" driving an LG 27" Ultrafine monitor.

It suddenly seems to have stopped. Not (seemingly) linked to an update, but now it just throws out about a dozen lines and then goes quiet. As one of the answers says: it’s a bug. I suppose. I haven’t changed any code related to the sprites.

@jeffpek42, can you put a regex pattern into the console’s filter to at least help you see other errors? I’m not in front of the computer so am only guessing….

Ok, so not an answer, but writing here for the watching members to receive a notification:

I've now found that, in my case, it happens when I use a build scheme for a universal app to run under Rosetta:

I haven't had a chance to check if such a build, when running on an Intel machine, also kicks out so much guff. I'm hoping it's queit when on a non-Apple Silicon machine.

If I switch to an Apple Silicon only build scheme then it all goes quiet. I'll log this as a bug.

I went back to my old Intel MacBook (also Monterey) and there is no problem there (same JUCE project). I also verified that the M1 problem does not depend on using the external display (happens also when LG is unplugged and only using the MacBook Pro screen). Building for native ("My Mac") instead of Rosetta gets around this problem, but then I have others related to audio which I won't belabor here. Nice that this one seems to be a Rosetta-only problem.

Back to Intel hardware it is for me for now . . .

I've run into this issue on my 2021 16" M1 Max mbp. Additionally, the issue shows up not only in xcode but also in Qt Creator when developing a C++ project. Some additional notes as it pertains to the error output:

The spammed error message only appears when the application is in the foreground of the display. If there's another window in front of it, the log spam stops.

Per @joster, it seems to be at a the refresh rate of my display. I've tested it with a 27" Dell 2K monitor, an LG monitor, and some dual samsung monitors using a DisplayLink 4K adapter. All report the same error.

Would be great to see some movement on this issue as it's currently preventing me from debugging effectively (regex filters clean up the output, but it's not blocking the error from logging so it's slowing debug builds down).

I have the same problem!!!

JUCE/C++ developer here: we get this same kind of debug log spam as well in our apps. Testing with JUCE's DemoRunner and the Projucer shows nothing of value, and this is with OpenGL enabled and disabled.

Meanwhile, our app does the opposite - it spams the logs with these errors when an OpenGL context is attached, and everything looks fine without.

Seeing this with a JUCE plugin using OpenGL as well... Let me know if you find a solution.

Thanks,

Rail

Hello! This is 100% case of projects that go through Rosetta on new Apple Silicon.

The simplest reproduction case that I could find using open source samples:

If architecture is set to: -x86_64 then the console is spamming with

2022-04-30 14:25:44.037689+0200 MargitMac[43672:1302152] [] [0x7fa8ea0e8e20] CVCGDisplayLink::setCurrentDisplay: 2
2022-04-30 14:25:44.037801+0200 MargitMac[43672:1302152] [] CurrentVBLDelta returned 0 for display 2 -- ignoring unreasonable value
2022-04-30 14:25:44.037825+0200 MargitMac[43672:1302152] [] [0x7fa8ea0e8e20] Bad CurrentVBLDelta for display 2 is zero. defaulting to 60Hz.
2022-04-30 14:25:44.037845+0200 MargitMac[43672:1302152] [] [0x7fa8ea0e8e00] CVDisplayLinkCreateWithCGDisplays count: 1 [displayID[0]: 0x2] [CVCGDisplayLink: 0x7fa8ea0e8e20]
2022-04-30 14:25:44.038117+0200 MargitMac[43672:1302152] [] [0x7fa8ea0e8e20] CVCGDisplayLink::setCurrentDisplay: 2
2022-04-30 14:25:44.038150+0200 MargitMac[43672:1302152] [] CurrentVBLDelta returned 0 for display 2 -- ignoring unreasonable value
2022-04-30 14:25:44.038170+0200 MargitMac[43672:1302152] [] [0x7fa8ea0e8e20] Bad CurrentVBLDelta for display 2 is zero. defaulting to 60Hz.
2022-04-30 14:25:44.038196+0200 MargitMac[43672:1302152] [] [0x7fa8ea0e8e00] CVDisplayLinkStart
2022-04-30 14:25:44.038215+0200 MargitMac[43672:1302152] [] [0x7fa8ea0e8e20] CVDisplayLink::start
2022-04-30 14:25:44.038525+0200 MargitMac[43672:1302756] [] [0x600002c7a4c0] CVXTime::reset
2022-04-30 14:25:44.038553+0200 MargitMac[43672:1302756] [] CurrentVBLDelta returned 0 for display 2 -- ignoring unreasonable value
2022-04-30 14:25:44.038571+0200 MargitMac[43672:1302756] [] [0x7fa8ea0e8e20] Bad CurrentVBLDelta for display 2 is zero. defaulting to 60Hz.
2022-04-30 14:25:44.064625+0200 MargitMac[43672:1302756] [] CurrentVBLDelta returned 0 for display 2 -- ignoring unreasonable value
2022-04-30 14:25:44.064666+0200 MargitMac[43672:1302756] [] [0x7fa8ea0e8e20] Bad CurrentVBLDelta for display 2 is zero. defaulting to 60Hz.
2022-04-30 14:25:44.081314+0200 MargitMac[43672:1302756] [] CurrentVBLDelta returned 0 for display 2 -- ignoring unreasonable value
2022-04-30 14:25:44.081378+0200 MargitMac[43672:1302756] [] [0x7fa8ea0e8e20] Bad CurrentVBLDelta for display 2 is zero. defaulting to 60Hz.
2022-04-30 14:25:44.097989+0200 MargitMac[43672:1302756] [] CurrentVBLDelta returned 0 for display 2 -- ignoring unreasonable value
2022-04-30 14:25:44.098017+0200 MargitMac[43672:1302756] [] [0x7fa8ea0e8e20] Bad CurrentVBLDelta for display 2 is zero. defaulting to 60Hz.
....

If the architecture is set to arm64, the console looks sane:

2022-04-30 14:29:40.615702+0200 MargitMac[44435:1306130] [] [0x1398b3a20] CVCGDisplayLink::setCurrentDisplay: 2
2022-04-30 14:29:40.615841+0200 MargitMac[44435:1306130] [] [0x1398b3a00] CVDisplayLinkCreateWithCGDisplays count: 1 [displayID[0]: 0x2] [CVCGDisplayLink: 0x1398b3a20]
2022-04-30 14:29:40.616056+0200 MargitMac[44435:1306130] [] [0x1398b3a20] CVCGDisplayLink::setCurrentDisplay: 2
2022-04-30 14:29:40.616075+0200 MargitMac[44435:1306130] [] [0x1398b3a00] CVDisplayLinkStart
2022-04-30 14:29:40.616086+0200 MargitMac[44435:1306130] [] [0x1398b3a20] CVDisplayLink::start
2022-04-30 14:29:40.616214+0200 MargitMac[44435:1306604] [] [0x60000387d730] CVXTime::reset

Sorry to not be adding more information - but this is an issue that's been unaddressed for an entire month. It's halting development of Qt, JUCE, and standard apps with xcode. It seems asinine that there hasn't been an official response on any steps Apple is performing to rectify the issue. What's going on?

Try adding OS_ACTIVITY_MODE to the envirable variables (within the run settings) and set that env variable to disable

This worked for me.

10

Same problem here. Simple SwiftUI App on M1 under Rosetta. Now graphics code at all. Very annoying.

Sudden error being logged continuously in XCode console
 
 
Q