git-for-windows / git

A fork of Git containing Windows-specific patches.
http://gitforwindows.org/
Other
8.19k stars 2.49k forks source link

Git bash opens invisible window owned by system that blocks all foreground windows on Windows 11 multi-session. #4945

Open bwhitley76 opened 1 month ago

bwhitley76 commented 1 month ago

Setup

$ git --version --build-options

** git version 2.45.0.windows.1
cpu: x86_64
built from commit: b5d0511969ccd9ab86395c37e5a7619d8b4e7c32
sizeof-long: 4
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon
 **
$ cmd.exe /c ver

** Microsoft Windows [Version 10.0.22631.3447] -- Multi-session **
# One of the following:
> type "C:\Program Files\Git\etc\install-options.txt"
> type "C:\Program Files (x86)\Git\etc\install-options.txt"
> type "%USERPROFILE%\AppData\Local\Programs\Git\etc\install-options.txt"
> type "$env:USERPROFILE\AppData\Local\Programs\Git\etc\install-options.txt"
$ cat /etc/install-options.txt

** Editor Option: VIM
Custom Editor Path:
Default Branch Option:
Path Option: Cmd
SSH Option: OpenSSH
Tortoise Option: false
CURL Option: OpenSSL
CRLF Option: CRLFAlways
Bash Terminal Option: MinTTY
Git Pull Behavior Option: Merge
Use Credential Manager: Enabled
Performance Tweaks FSCache: Enabled
Enable Symlinks: Disabled
Enable Pseudo Console Support: Disabled
Enable FSMonitor: Disabled **

This bug only reproduces on Windows Multi-session images in Azure

Details

Bash

** "C:\Program Files\Git\git-bash.exe" --cd-to-home **

Expected bash to work properly without invisible conhost.exe window from preventing the use of bash

conhost.exe process launches with bash.exe as an invisible window and prevents users from interacting with bash window

insert URL here

bwhitley76 commented 1 month ago

I have the outputs of a user mode debug of this issue. Conhost.exe is the foregroud app with keyboard/mouse hooks but has no active/focused window. Conhost.exe was launched by cygwin-console-helper which is no longer running.

// Git-Bash uses MinTTY, which in turn invokes Cygwin-Console-Helper, responsible for initiating the conhost process.

// Please note that Cygwin-Console-Helper has already terminated and has no active threads.

// This indicates that there is no process waiting for conhost.exe to terminate. However, we lack insight into how they invoked conhost without access to the source code of that process.

dscho commented 1 month ago

This bug only reproduces on Windows Multi-session images in Azure

Could you provide a clear and concise set of steps how to reproduce?

bwhitley76 commented 1 month ago

This bug only reproduces on Windows Multi-session images in Azure

Could you provide a clear and concise set of steps how to reproduce?

  1. Deploy Windows 11 Enterprise multi-session, version 23H2 - Gen2 image in Azure
  2. Download Git-2.25.0-64-bit from https://gitforwindows.org
  3. Install git for windows with all default settings.
  4. Launch Git Bash by running "C:\Program Files\Git\git-bash.exe" --cd-to-home
  5. Try to type or use the bash console window. The bash console window is unusable due to an invisible conhost.exe window that is covering the bash console window.
  6. Use Process Explorer to see the conhost.exe process that was called.
  7. Kill conhost.exe to clear the problem state and the bash window is now usable.
dscho commented 1 month ago

@bwhitley76 thank you!

Does this also reproduce with a regular MSYS2, or even with a MinTTY of a regular Cygwin installation?

bwhitley76 commented 1 month ago

Thanks @dscho , I have not tried MSYS2 or Cygwin installs. I'll see if it reproduces via these install methods early next week.

coderextreme commented 1 month ago

When I type "Git For Windows" from the Windows 10 Search (lower left corner) a window launches then quickly disappears.