[v4.6.2 C#] Project freezes every 2 runs on main monitor

Godot Version

v4.6.2.stable.mono.official [71f334935]

Question

When I run my project, it either runs smoothly or freezes for some time (it sometimes manages to run for a tiny split second before freezing though). These two behaviours alternate; if it ran smoothly then the next time it’ll freeze, and so on… It also alternates whether or not I compile, add code, or anything between two runs. What bothers me is, there seems to be no error being displayed anywhere.

I also noticed that it doesn’t happen on my secondary monitor AND that it doesn’t influence the “alternating process”. If it was smooth the last time I ran it on the main monitor, it will freeze once I run it again, no matter how many times I run it on the secondary monitor in between. And if it froze then I run it as many times as I want on the other monitor, it will run smoothly exactly once when I come back on the main.

It didn’t happen until today. I already tried reverting all changes back, deleting any new scripts… Quitting/relaunching Godot doesn’t help. Rebooting the computer doesn’t either.

There’s no while loop in the entire C# code, no async tasks either. I tried to create another project to see if I could replicate the issue, to no avail.

Has anyone run into a similar issue already and solved it? I don’t really know what I could provide to help diagnose this…

Thanks in advance.

[EDIT] Additional testing: only seems to happen on fullscreen and exclusive fullscreen modes. Yet as I said, it didn’t happen before today…

Here’s some things to try:

  • Look to see if your video drivers were updated while you were sleeping last night, and if so, roll them back to the previous version.
  • Swap the monitor cables in their ports. Does the issue stay the same or change? Does it follow the monitor?
  • Swap which monitor is primary (if you can) in your OS. Does the issue follow the monitor?
  • Pull up a hardware monitor. See if your GPU is overheating when the issue happens. I use CPUID HWMonitor on Windows. You should be able to use htop in a terminal window on Linux (and maybe Mac).
  • Disable the Game toolbar if its enabled when you run the game.

Thank you for your kind suggestions.

• I started by rolling my drivers back and saw no change at first, then by trying a bit more I noticed I was mistaken when assuming there was some kind of “alternating” behaviour; the project used to run smoothly once then froze everytime unless I shut it down myself quickly enough, then it reverted back to 1 smooth run before freezing again. I just so happened to have been closing it fast whenever I ran into the issue again…

• Then, I tried changing the primary monitor in the OS settings. And upon doing this, I started experiencing this same weird behaviour on both monitors. I swapped the primary monitor twice to confirm, even when going back to the “normal” setup I had the issue on both monitors.

• I then tried to download HWMonitor to check, launched it and… And I coudn’t replicate the issue for a while, which surprised me. Yet after some time I ran into the exact same issue again. I checked on HWMonitor and nothing seemed to be going off the roof.

• The toolbar was already disabled.

So now I just have the same issue on both monitors. Which… doesn’t solve anything but at least it’s more logic somehow… And yet it was doing well for a few minutes after no significant change.

At least you made it more reproducible. I’m honestly not sure what to try next. Hopefully someone else will have an idea.