terminal icon indicating copy to clipboard operation
terminal copied to clipboard

Brand new Windows 10 install: This terminal has encountered an issue with the graphics driver and it could not recover in time.

Open CorpulentBrony opened this issue 1 year ago • 23 comments

Windows Terminal version

1.17.11461.0

Windows build number

10.0.19045.0

Other Software

N/A

Steps to reproduce

  • New computer, fresh install of Windows 10
  • Run all updates for Windows 10
  • Ensure all drivers (graphics card, etc.) are up-to-date
  • Enable WSL
  • Install Terminal (or Terminal Preview, both versions behave identically)
  • Open Terminal (or Terminal Preview) and receive the error message, "This terminal has encountered an issue with the graphics driver and it could not recover in time. It has been suspended."
  • Terminal is completely unusable, there is no place to type anything or use the terminal

image

Expected Behavior

  • New computer, fresh install of Windows 10
  • Run all updates for Windows 10
  • Ensure all drivers (graphics card, etc.) are up-to-date
  • Enable WSL
  • Install Terminal (or Terminal Preview, both versions behave identically)
  • Open Terminal (or Terminal Preview) and be able to use it

Actual Behavior

  • Open Terminal (or Terminal Preview) and receive the error message, "This terminal has encountered an issue with the graphics driver and it could not recover in time. It has been suspended."
  • Terminal is completely unusable, there is no place to type anything or use the terminal

image

CorpulentBrony avatar Jun 26 '23 01:06 CorpulentBrony

My settings.json, only change I've made was disabling Atlas engine based on a troubleshooting solution I saw here. Didn't make a difference:

{
    "$help": "https://aka.ms/terminal-documentation",
    "$schema": "https://aka.ms/terminal-profiles-schema",
    "actions": 
    [
        {
            "command": 
            {
                "action": "copy",
                "singleLine": false
            },
            "keys": "ctrl+c"
        },
        {
            "command": "paste",
            "keys": "ctrl+v"
        },
        {
            "command": "find",
            "keys": "ctrl+shift+f"
        },
        {
            "command": 
            {
                "action": "splitPane",
                "split": "auto",
                "splitMode": "duplicate"
            },
            "keys": "alt+shift+d"
        }
    ],
    "copyFormatting": "none",
    "copyOnSelect": false,
    "defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
    "experimental.rendering.software": false,
    "newTabMenu": 
    [
        {
            "type": "remainingProfiles"
        }
    ],
    "profiles": 
    {
        "defaults": 
        {
            "useAtlasEngine": false
        },
        "list": 
        [
            {
                "commandline": "%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "hidden": false,
                "name": "Windows PowerShell"
            },
            {
                "commandline": "%SystemRoot%\\System32\\cmd.exe",
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "hidden": false,
                "name": "Command Prompt"
            },
            {
                "guid": "{17bf3de4-5353-5709-bcf9-835bd952a95e}",
                "hidden": true,
                "name": "Ubuntu-22.04",
                "source": "Windows.Terminal.Wsl"
            },
            {
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden": false,
                "name": "Azure Cloud Shell",
                "source": "Windows.Terminal.Azure"
            },
            {
                "guid": "{d7b20cea-47a9-518c-95a4-c8bd91e2e1c6}",
                "hidden": false,
                "name": "Ubuntu 22.04.2 LTS",
                "source": "CanonicalGroupLimited.Ubuntu22.04LTS_79rhkp1fndgsc"
            }
        ]
    },
    "schemes": 
    [
        {
            "background": "#0C0C0C",
            "black": "#0C0C0C",
            "blue": "#0037DA",
            "brightBlack": "#767676",
            "brightBlue": "#3B78FF",
            "brightCyan": "#61D6D6",
            "brightGreen": "#16C60C",
            "brightPurple": "#B4009E",
            "brightRed": "#E74856",
            "brightWhite": "#F2F2F2",
            "brightYellow": "#F9F1A5",
            "cursorColor": "#FFFFFF",
            "cyan": "#3A96DD",
            "foreground": "#CCCCCC",
            "green": "#13A10E",
            "name": "Campbell",
            "purple": "#881798",
            "red": "#C50F1F",
            "selectionBackground": "#FFFFFF",
            "white": "#CCCCCC",
            "yellow": "#C19C00"
        },
        {
            "background": "#012456",
            "black": "#0C0C0C",
            "blue": "#0037DA",
            "brightBlack": "#767676",
            "brightBlue": "#3B78FF",
            "brightCyan": "#61D6D6",
            "brightGreen": "#16C60C",
            "brightPurple": "#B4009E",
            "brightRed": "#E74856",
            "brightWhite": "#F2F2F2",
            "brightYellow": "#F9F1A5",
            "cursorColor": "#FFFFFF",
            "cyan": "#3A96DD",
            "foreground": "#CCCCCC",
            "green": "#13A10E",
            "name": "Campbell Powershell",
            "purple": "#881798",
            "red": "#C50F1F",
            "selectionBackground": "#FFFFFF",
            "white": "#CCCCCC",
            "yellow": "#C19C00"
        },
        {
            "background": "#282C34",
            "black": "#282C34",
            "blue": "#61AFEF",
            "brightBlack": "#5A6374",
            "brightBlue": "#61AFEF",
            "brightCyan": "#56B6C2",
            "brightGreen": "#98C379",
            "brightPurple": "#C678DD",
            "brightRed": "#E06C75",
            "brightWhite": "#DCDFE4",
            "brightYellow": "#E5C07B",
            "cursorColor": "#FFFFFF",
            "cyan": "#56B6C2",
            "foreground": "#DCDFE4",
            "green": "#98C379",
            "name": "One Half Dark",
            "purple": "#C678DD",
            "red": "#E06C75",
            "selectionBackground": "#FFFFFF",
            "white": "#DCDFE4",
            "yellow": "#E5C07B"
        },
        {
            "background": "#FAFAFA",
            "black": "#383A42",
            "blue": "#0184BC",
            "brightBlack": "#4F525D",
            "brightBlue": "#61AFEF",
            "brightCyan": "#56B5C1",
            "brightGreen": "#98C379",
            "brightPurple": "#C577DD",
            "brightRed": "#DF6C75",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#E4C07A",
            "cursorColor": "#4F525D",
            "cyan": "#0997B3",
            "foreground": "#383A42",
            "green": "#50A14F",
            "name": "One Half Light",
            "purple": "#A626A4",
            "red": "#E45649",
            "selectionBackground": "#FFFFFF",
            "white": "#FAFAFA",
            "yellow": "#C18301"
        },
        {
            "background": "#002B36",
            "black": "#002B36",
            "blue": "#268BD2",
            "brightBlack": "#073642",
            "brightBlue": "#839496",
            "brightCyan": "#93A1A1",
            "brightGreen": "#586E75",
            "brightPurple": "#6C71C4",
            "brightRed": "#CB4B16",
            "brightWhite": "#FDF6E3",
            "brightYellow": "#657B83",
            "cursorColor": "#FFFFFF",
            "cyan": "#2AA198",
            "foreground": "#839496",
            "green": "#859900",
            "name": "Solarized Dark",
            "purple": "#D33682",
            "red": "#DC322F",
            "selectionBackground": "#FFFFFF",
            "white": "#EEE8D5",
            "yellow": "#B58900"
        },
        {
            "background": "#FDF6E3",
            "black": "#002B36",
            "blue": "#268BD2",
            "brightBlack": "#073642",
            "brightBlue": "#839496",
            "brightCyan": "#93A1A1",
            "brightGreen": "#586E75",
            "brightPurple": "#6C71C4",
            "brightRed": "#CB4B16",
            "brightWhite": "#FDF6E3",
            "brightYellow": "#657B83",
            "cursorColor": "#002B36",
            "cyan": "#2AA198",
            "foreground": "#657B83",
            "green": "#859900",
            "name": "Solarized Light",
            "purple": "#D33682",
            "red": "#DC322F",
            "selectionBackground": "#FFFFFF",
            "white": "#EEE8D5",
            "yellow": "#B58900"
        },
        {
            "background": "#000000",
            "black": "#000000",
            "blue": "#3465A4",
            "brightBlack": "#555753",
            "brightBlue": "#729FCF",
            "brightCyan": "#34E2E2",
            "brightGreen": "#8AE234",
            "brightPurple": "#AD7FA8",
            "brightRed": "#EF2929",
            "brightWhite": "#EEEEEC",
            "brightYellow": "#FCE94F",
            "cursorColor": "#FFFFFF",
            "cyan": "#06989A",
            "foreground": "#D3D7CF",
            "green": "#4E9A06",
            "name": "Tango Dark",
            "purple": "#75507B",
            "red": "#CC0000",
            "selectionBackground": "#FFFFFF",
            "white": "#D3D7CF",
            "yellow": "#C4A000"
        },
        {
            "background": "#FFFFFF",
            "black": "#000000",
            "blue": "#3465A4",
            "brightBlack": "#555753",
            "brightBlue": "#729FCF",
            "brightCyan": "#34E2E2",
            "brightGreen": "#8AE234",
            "brightPurple": "#AD7FA8",
            "brightRed": "#EF2929",
            "brightWhite": "#EEEEEC",
            "brightYellow": "#FCE94F",
            "cursorColor": "#000000",
            "cyan": "#06989A",
            "foreground": "#555753",
            "green": "#4E9A06",
            "name": "Tango Light",
            "purple": "#75507B",
            "red": "#CC0000",
            "selectionBackground": "#FFFFFF",
            "white": "#D3D7CF",
            "yellow": "#C4A000"
        },
        {
            "background": "#300A24",
            "black": "#171421",
            "blue": "#0037DA",
            "brightBlack": "#767676",
            "brightBlue": "#08458F",
            "brightCyan": "#2C9FB3",
            "brightGreen": "#26A269",
            "brightPurple": "#A347BA",
            "brightRed": "#C01C28",
            "brightWhite": "#F2F2F2",
            "brightYellow": "#A2734C",
            "cursorColor": "#FFFFFF",
            "cyan": "#3A96DD",
            "foreground": "#FFFFFF",
            "green": "#26A269",
            "name": "Ubuntu-22.04-ColorScheme",
            "purple": "#881798",
            "red": "#C21A23",
            "selectionBackground": "#FFFFFF",
            "white": "#CCCCCC",
            "yellow": "#A2734C"
        },
        {
            "background": "#000000",
            "black": "#000000",
            "blue": "#000080",
            "brightBlack": "#808080",
            "brightBlue": "#0000FF",
            "brightCyan": "#00FFFF",
            "brightGreen": "#00FF00",
            "brightPurple": "#FF00FF",
            "brightRed": "#FF0000",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#FFFF00",
            "cursorColor": "#FFFFFF",
            "cyan": "#008080",
            "foreground": "#C0C0C0",
            "green": "#008000",
            "name": "Vintage",
            "purple": "#800080",
            "red": "#800000",
            "selectionBackground": "#FFFFFF",
            "white": "#C0C0C0",
            "yellow": "#808000"
        }
    ],
    "themes": []
}

CorpulentBrony avatar Jun 26 '23 01:06 CorpulentBrony

Could you use DebugView to try and see if there's any relevant output when you launch Windows Terminal?

lhecker avatar Jun 26 '23 11:06 lhecker

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

This has been happening to me using panes and my $PAGER (I think) on W11.

Benjamin-Connelly avatar Sep 20 '23 17:09 Benjamin-Connelly

Same issue on Windows 11 here Only started after updating all drivers (Nvidia + Intel)

CRYPTO-GENIK avatar Nov 22 '23 05:11 CRYPTO-GENIK

I had this issue on my Lenovo Thinkpad W520. Setting experimental.rendering.software from false to true solved the problem on my side (the procedure is equivalent to turn on "use software rendering" (not sure about the name) in the settings).

Terminal Windows Version : 1.18.3181.0 Windows 10 Version 22H2 Build 19045.3803

ValentinRonsseray avatar Dec 27 '23 20:12 ValentinRonsseray

Same problem as @Valentin-Ronsseray on Lenovo Thinkpad W520 but setting experimental.rendering.software to true. does not fix the issue. However, if I connect to the laptop via Remote Desktop it works. Something seems really broken with the rendering. Using "Cmder" until this gets fixed.

0x6d6e647a avatar Jan 06 '24 06:01 0x6d6e647a

@lhecker I ran DebugView (both 32-bit and 64-bit, both as normal user and as administrator) and then ran Windows Terminal (with software rendering enabled and disabled). There was no relevant output in DebugView.

I ran Windows Terminal and attached to it with the x64dbg debugger and click the Resume button and caught many exceptions in nvumdshimx, d3dll, dxgi. I've attached the log from x64dbg: log-Fri Jan 5 22-52-09 2024.txt

Please note the debug log was generated with software rendering disabled.

Let me know if you need any more information!

0x6d6e647a avatar Jan 06 '24 06:01 0x6d6e647a

@0x6d6e647a Wow that's excellent! 😊 There's basically two failures: DxRenderer.cpp(679) and DxRenderer.cpp(1291). The latter is the same as the former (it's the caller). The issue occurs due to the CreateSwapChainForCompositionSurfaceHandle call failing. Given that the exceptions happen every time right before the CreateSwapChainForCompositionSurfaceHandle call fails, I suspect that they're correlated. I'll ask around what the best way to debug this is.

In the meantime, if you'd like, you could create a dump of the process at the moment when the first exception hits and send it to my mail (see my GitHub profile). That may also clear things up, since I have access to the source code and the unstripped debug symbols (not Nvidia's, but at least Microsoft's).

lhecker avatar Jan 08 '24 18:01 lhecker

@lhecker I sent you an email containing the dumps. Please let me know if I can provide any more assistance. Thank you for looking into this!

0x6d6e647a avatar Jan 13 '24 00:01 0x6d6e647a

Sent @lhecker an improved dump file via email to examine. Please let me know if I can provide any more assistance. Thanks again!

0x6d6e647a avatar Jan 31 '24 02:01 0x6d6e647a

@0x6d6e647a sorry for the late response. I was able to take a look at the dump now. Can you try and see what happens if you enable the "AtlasEngine" in the "Rendering" settings? Does the issue still occur then?

But I think the chance that this fixes the issue is rather small unfortunately. This is the stack trace of the exception you caught (the function names aren't a secret thankfully):

d3d11!ThrowFailure
d3d11!NDXGI::CDevice::CreateFenceImpl
d3d11!NDXGI::CDevice::CreateFenceImpl
d3d11!CFence::FinalConstruct
d3d11!CLayeredObject<CFence>::{ctor}
d3d11!CLayeredObject<CFence>::CreateInstance
d3d11!CDevice::CreateLayeredChild
d3d11!NDXGI::CDevice::CreateLayeredChild
d3d11!NOutermost::CDeviceChild::FinalConstruct
d3d11!CUseCountedObject<NOutermost::CDeviceChild>::{ctor}
d3d11!CUseCountedObject<NOutermost::CDeviceChild>::CreateInstance
d3d11!NOutermost::CDevice::CreateLayeredChild
d3d11!NDXGI::CDevice::CreateFence
dxgi!CDXGISwapChain::CreateTrackedFenceExtended
dxgi!CDXGISwapChain::BindToDwm
dxgi!CDXGISwapChain::InitializeSwapChainDeviceState
dxgi!CDXGISwapChainApplicationClass::FinalConstruct
dxgi!CMTUseCountedObject<CDXGISwapChainApplicationClass>::CMTUseCountedObject<CDXGISwapChainApplicationClass>
dxgi!CMTUseCountedObject<CDXGISwapChainApplicationClass>::CreateInstance
dxgi!CDXGIFactory::CreateSwapChainImpl
dxgi!CDXGIFactory::CreateSwapChainForCompositionSurfaceHandle
Microsoft_Terminal_Control!Microsoft::Console::Render::DxEngine::_CreateDeviceResources
Microsoft_Terminal_Control!Microsoft::Console::Render::DxEngine::StartPaint
Microsoft_Terminal_Control!Microsoft::Console::Render::Renderer::_PaintFrameForEngine
Microsoft_Terminal_Control!Microsoft::Console::Render::Renderer::PaintFrame
Microsoft_Terminal_Control!Microsoft::Console::Render::RenderThread::_ThreadProc

CreateFenceImpl's purpose is to call CreateSynchronizationObject2 and it throws an exception if that call fails. The parameter that it passed in your case were this:

D3DKMT_CREATESYNCHRONIZATIONOBJECT2{
    .hDevice = 0x40003a80,
    .Info = {
        .Type = D3DDDI_MONITORED_FENCE,
        .Flags = { 
            .Shared                = 1,
            .NtSecuritySharing     = 1,
            .NoGPUAccess           = 1,
            .DeferredWaits         = 1,
        },
        .MonitoredFence = {
            .InitialFenceValue           = 0,
            .FenceValueCPUVirtualAddress = 0,
            .FenceValueGPUVirtualAddress = 0,
            .EngineAffinity              = 0,
        },
        .SharedHandle = 0,
    },
    .hSyncObject = 0,
};

The call failed with status 0x80070057 which is "The parameter is incorrect.". CreateSynchronizationObject2 is part of the driver Device Driver Interface for GPUs. In other words, your GPU driver is returning a failure when creating a fence (a fence is basically a semaphore). Looking through your other GPU-related objects I don't see anything that would indicate that your device works different from my PC.

I'll ask a colleague about this who knows more about GPU drivers and DWM. In the meantime, I'd suggest checking whether there are any GPU driver updates (or similar) available for your machine.

lhecker avatar Feb 07 '24 00:02 lhecker

I encountered this issue and successfully resolved it on my PC. I noticed abnormal CPU usage while playing a game, and then I realized that the GPU wasn't functioning properly. To address this, I uninstalled my Nvidia GPU from the Device Manager and performed a "Scan for hardware changes" to restart it. This resolved the problem.

ghost avatar Feb 09 '24 03:02 ghost

@lhecker I enabled the "AtlasEngine" and tired it with both software and hardware rendering but this did not resolve this issue. However, the behavior of the failure was different. The program now additionally displays: "Warning: Renderer encountered an unexpected error -2147024809". Hopefully this information might help. If you want I can get another dump of this behavior.

In terms of GPU, I thought it might be relevant to mention some peculiarities of the Lenovo W520. It is a very early generation of hybrid graphics so the output sinks between the Nvidia and Intel graphics are not shared. Details are available on the Arch wiki. I had Bumblebee properly setup with Gentoo Linux but was disappointed at the strange issues with connecting to projectors for work or using the docking station at my desk. I had Windows 7 at the time setup for dual boot and it worked flawlessly so I gave up on Linux on the hardware and stuck with Windows. This worked fine through Windows 8 and Windows 10 but at some point a Windows update happened and Windows began to display the same behavior as Linux in regards to the outputs. Because such early hybrid graphics hardware is primitive and exotic now so support being silently dropped isn't surprising. Around the same time I noticed I couldn't use the "Performance" tab in the "Task Manager" which I at the time debugged was related to the graphics drivers.

I suppose this issue might just come down to the strange early hybrid graphics setup on the W520. As it stands the W520 is not supported for Windows 11 so I'll probably be migrating this machine back to Gentoo Linux once this issue is resolved. I'm only keeping Windows on it for the time being to assist by generating dumps.

@JymirJones I'll try your suggestion and see if it fixes the issue for me. I have upgraded this system from Windows 7 all the way to Window 10 without reinstalling windows so it wouldn't be too surprising if something like this fixes it.

0x6d6e647a avatar Feb 16 '24 00:02 0x6d6e647a

@lhecker @JymirJones Uninstalling the device and rebooted and now Windows Terminal works perfectly with all combinations of "AtlasEngine" being on/off and Software Rendering being on/off. I checked in Device Manager and it installed the same version I had before but I suppose uninstalled it cleaned up some bad setting somewhere. For what it's worth the "Performance" tab in Task Manager still crashes. Seems the issue wasn't caused by Windows Terminal at all in my case. Thanks @JymirJones for the fix! Special thanks to @lhecker for working closely with me on the crash dumps and being extra patient!

0x6d6e647a avatar Feb 16 '24 00:02 0x6d6e647a

-2147024809 is 0x80070057 which is E_INVALIDARG, which is the same error that I found in your dump and described above. AtlasEngine's error handling is a bit more robust and so that's probably why we can now see the actual error code. This confirms that your dump indeed contained the failing stack trace. Nice!

I've read a bit more into the W520 and it does seem like this may be a driver issue. Windows Update also distributes driver updates from partners including from Lenovo, so maybe one of their driver updates had (and continues to have) a bug?

That aside, it's not a well known feature, but Windows allows you to choose your preferred graphics card on a per application basis. It's in the System > Display > Graphics section of the Settings application: image

The new text renderer in Windows Terminal will respect this setting and use the GPU that you choose there. If Windows Terminal is not listed there, you can add it by clicking the Browse button at the top of the page (choose "Microsoft store app" in the dropdown). This setting also exists in Windows 10 at the same location, but it looks a little bit different.

@0x6d6e647a Thanks again for helping me investigate this! It's unfortunate that we can't help you further, but it was definitely super helpful to get an example on how such driver issues can look like (this my first time encountering such a GPU driver failure). @JymirJones Thanks for letting us know how you resolved this issue! I'll use this next time someone has the same issue - maybe it helps them as well. :)

lhecker avatar Feb 16 '24 01:02 lhecker

Quick follow up. After a reboot the issue returned. Following the same steps resolved it again. I noticed when Windows Terminal works the brightness up and down keys on the keyboard will not work. This is not a major problem since I can still adjust the brightness from the notification center. After a reboot (perhaps related to Windows update?) the brightness keys on the keyboard work but Windows Terminal has the same issues. At this point I think it's a combination of early implementation of hybrid graphics hardware on the W520 and unsupported / abandoned driver support from Nvidia. I'm going to retire this laptop in the coming months so it's not a big deal.

Just wanted to keep everyone up to date on the issue and solution. Thanks again to everyone for their help!

0x6d6e647a avatar Mar 02 '24 04:03 0x6d6e647a