Bug: random nvoglv64.dll crash after driver update

In our OpenGL application, we started getting random crashes after updating our Nvidia driver. We’re not sure which driver version is the culprit, but we’re running on:

GPU: NVIDIA GeForce GTX 1050 Ti with Max-Q Design
Driver version: (08.04.2021)

The crash happens randomly and follows a “D3D11: Removing Device.” message.

We tried setting the TdrDelay flag in the registry as suggested in another post, but that didn’t work. (BUG REPORT : nvoglv64.DLL)

We found a temporary “solution” to the problem by creating a profile in the nvidia control panel for our program and setting the preferred GPU as to use “High-performance NVIDIA processor”. This prevents the crashes for some reason. This is needed even though we are already enabling NVIDIA Optimus using the NvOptimusEnablement flag.