terminal icon indicating copy to clipboard operation
terminal copied to clipboard

Windows Vim crashes terminal when I close the tab

Open 0x00000FF opened this issue 7 years ago â€ĸ 7 comments

Environment

Windows build number: Microsoft Windows [Version 10.0.18932.1000]
Windows Terminal version (if applicable): 0.2.1831.0

Any other software?
VIM - Vi IMproved 8.1 (2018 May 18, compiled May 18 2018 18:26:56), 32bit Console version, [Korean]

Steps to reproduce

Start windows terminal with PowerShell 6.2.0 and runs Vim with vim. PATH for vim was C:\Program Files (x86)\Vim\vim81. Close tab with vim is running.

Expected behavior

Tab must be closed. If the tab was only one, terminal must be terminated.

Actual behavior

Entire terminal is crashed.

0x00000FF avatar Jul 08 '19 05:07 0x00000FF

Correct me if I am wrong, Windows Vim is your last tab and you're attempting to close the terminal through the tab?

TayYuanGeng avatar Jul 08 '19 08:07 TayYuanGeng

Whether the tab is the last or not, Terminal always crashed when I close a tab which is running Windows Vim

0x00000FF avatar Jul 08 '19 08:07 0x00000FF

Seems like a similar issue to #36

TayYuanGeng avatar Jul 08 '19 09:07 TayYuanGeng

I don't think so, because there's no cpu or memory fluctuation, terminal just stays without any responses.

I've tested with sample application which changes console title to "한ęĩ­ė–´", "ãĢãģんご", "æŧĸ字" and even same title with my vim "[렜ëĒŠė—†ėŒ] - VIM2", It seems that unicode characters are not the reason of terminal crash.

0x00000FF avatar Jul 08 '19 09:07 0x00000FF

Confirmed this as happening on Dev Build compiled from source with master at commit 7eae91:

Windows:     10.0.18362.0
PowerShell:  5.1.18362.145
VIM - Vi IMproved 8.1 (2018 May 18, compiled May 18 2018 18:26:56)

Attached profiler showed no change in memory consumption and CPU dropped to 0% from either ConHost.exe or WindowsTerminal, event viewer reports:

 Process ID: 3724
 Start Time: 01d53576439f9dd6
 Termination Time: 7
 Application Path: C:\source\richardslater\terminal\src\cascadia\CascadiaPackage\bin\x64\Release\AppX\WindowsTerminal.exe
 Report Id: f8bc8e57-e771-400e-b1e0-c9634c1baab9
 Faulting package full name: WindowsTerminalDev_0.0.1.0_x64__8wekyb3d8bbwe
 Faulting package-relative application ID: App
 Hang type: Cross-process

Only occurs in PowerShell and CMD, not in WSL Bash (Ubuntu) and seems to occur regardless of whether the tab is the last tab, first tab, middle tab, etc.

Possibly unrelated but, when attaching a debugger to the ConHost.exe that Vim is executing under, ConHost seems to be stuck in the for loop in terminal\src\renderer\base\renderer.cpp:252:

void Renderer::TriggerTeardown()
{
    // We need to shut down the paint thread on teardown.
    _pThread->WaitForPaintCompletionAndDisable(INFINITE);

    // Then walk through and do one final paint on the caller's thread.
    for (IRenderEngine* const pEngine : _rgpEngines)
    {
        bool fEngineRequestsRepaint = false;
        HRESULT hr = pEngine->PrepareForTeardown(&fEngineRequestsRepaint);
        LOG_IF_FAILED(hr);

        if (SUCCEEDED(hr) && fEngineRequestsRepaint)
        {
            LOG_IF_FAILED(_PaintFrameForEngine(pEngine));
        }
    }
}

RichardSlater avatar Jul 08 '19 10:07 RichardSlater

IIRC this crash is #1380, but @DHowett-MSFT can correct me if I'm wrong. It seems like it's still happening even after the fix from that issue.

zadjii-msft avatar Jul 08 '19 14:07 zadjii-msft

This is almost certainly #1380 (we love this bug, we just keep bringing it back)

DHowett-MSFT avatar Jul 08 '19 21:07 DHowett-MSFT