godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.81k stars 20.14k forks source link

Godot 4.3RC1 crashed when Surface Book 2 disabled discrete NVidia card while on battery power #94949

Closed djmcgaughran closed 1 month ago

djmcgaughran commented 1 month ago

Tested versions

Occurred in 4.3 RC1

System information

Godot v4.3.rc1 - Windows 10.0.19045 - Vulkan (Forward+) - integrated Intel(R) UHD Graphics 620 (Intel Corporation; 30.0.101.1339) - Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz (8 Threads)

Issue description

I am building a small prototype, and had set up a Camera3D in a scene with DirectionalLight3D, CSGBox3D (as ground plane) and an imported model. To check the camera perspective, I switched into Cinematic Preview in the 3D View, then proceeded to adjust the Transform of the imported model scene. Upon editing the Z value, the editor froze, showed a blank tooltip, flashed a 'critical error' message briefly (so I couldn't tell what the issue was), then crashed the Godot editor completely.

Upon reopening Godot and reloading the project, I was able to edit the transform successfully, though could not find any error messages or logs from the previous session that crashed.

Windows Event Viewer -> Application logs show a few errors:

The description for Event ID 2 from source NVIDIA OpenGL Driver cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: 

The NVIDIA OpenGL driver has encountered
an out of memory error. This application might
behave inconsistently and fail.
(pid=16072 godot_v4.3-rc1_win64.exe 64bit)

The message resource is present but the message was not found in the message table

and

Faulting application name: Godot_v4.3-rc1_win64.exe, version: 4.3.0.0, time stamp: 0x66a20e0b
Faulting module name: nvwgf2umx.dll, version: 27.21.14.6140, time stamp: 0x600b1b2d
Exception code: 0xc0000005
Fault offset: 0x000000000023f2b6
Faulting process ID: 0x3ec8
Faulting application start time: 0x01dae271c22991af
Faulting application path: C:\Apps\ProgTools\Godot\Godot_v4.3-rc1_win64.exe
Faulting module path: C:\WINDOWS\System32\DriverStore\FileRepository\nvmso.inf_amd64_5d7d7460e749fb8f\nvwgf2umx.dll
Report ID: b03446df-9c8d-459a-b83d-877f1bd7ed23
Faulting package full name: 
Faulting package-relative application ID: 

Being a Surface Book 2, my system is running an NVidia GeForce GTX 1060, with fallback to integrated Intel UHD 620 graphics when running solely on battery power and the power level drops below a certain threshold. This is supported by the System event log containing the following SurfaceHotPlug entry at the same time when the Godot editor started to freeze:

DGPU state change: DGPUPresent=0

How feasible would it be to make the Godot editor more resilient to graphics adaptor changes like this? This presented itself as running out of video memory, and my understanding is that the Intel integrated graphics uses main system memory (of which I have 16GB).

Steps to reproduce

I have been unable to reproduce this reliably; the steps I had done at this point are:

  1. Switch to the 3D view for the main game scene
  2. In the viewport menu, enable Cinematic Preview
  3. Select the model scene instance child ("Plane")
  4. In the Properties pane, specifically under Node 3D -> Transform -> Position, edit the position values.

This may be reproducible on other portable systems with a discrete graphics processor that becomes disabled when both of the following are true:

  1. The system is disconnected from mains power, causing it to run on battery only;
  2. The battery power level drops below a certain threshold

Minimal reproduction project (MRP)

FlightTest.zip

akien-mga commented 1 month ago

Sadly I don't think that's something Godot, or any application using graphics APIs, can handle gracefully.

Godot doesn't support changing the used GPU at runtime, and I'm not sure that's possible at all without restarting the process.

I wonder if we could at least stop rendering anything and force save state in the editor, and close the process gracefully.

CC @godotengine/rendering @bruvzg

alvinhochun commented 1 month ago

I guess this is related to https://github.com/godotengine/godot-proposals/issues/10269 and https://github.com/godotengine/godot-proposals/issues/6423 .

Just curious, if you get Firefox or Chrome to run on the discrete GPU then disconnect it, are they able to recover and switch GPU?

djmcgaughran commented 1 month ago

Yes, I was running Firefox 100.0.2 throughout (as well as the Windows calculator) without any issues. I had Blender 4.0 open earlier, but I think I had closed it by the time the discrete GPU was disabled.

akien-mga commented 1 month ago

I guess this is related to godotengine/godot-proposals#10269 and godotengine/godot-proposals#6423 .

Indeed, I think we can close as duplicate of https://github.com/godotengine/godot-proposals/issues/10269 which covers the same problem.