git-for-windows / git

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

Git and Git bash lock up on Windows 11 Multi-Session #5119

Open apjanke opened 2 weeks ago

apjanke commented 2 weeks ago

Possibly related, but I'm not sure: https://github.com/git-for-windows/git/issues/4945

Summary

On Windows 11 Enterprise Multi-Session (on Azure VMs), Git frequently "locks up" and becomes unresponsive. I see this in Git bash, and maybe with git called by SourceTree (Atlassian's Git GUI), which shells out to git. Sometimes other GUI programs become unresponsive too after this happens.

Setup

Git for Windows 64-bit. I have seen this issue on various versions over the past year or two, but it just cropped up again in 2.46.0, after seemingly not having the problem in 2.45.2.windows.1.

C:\Users\Andrew.Janke>git --version --build-options
git version 2.46.0.windows.1
cpu: x86_64
built from commit: 2e6a859ffc0471f60f79c1256f766042b0d5d17d
sizeof-long: 4
sizeof-size_t: 8
shell-path: D:/git-sdk-64-build-installers/usr/bin/sh
feature: fsmonitor--daemon
libcurl: 8.9.0
OpenSSL: OpenSSL 3.2.2 4 Jun 2024
zlib: 1.3.1

Windows 11 Enterprise Multi-Session, 64-bit. This is a special build of Windows for desktop virtualization that is like Windows Server under the hood and allows multiple simultaneous RDP sessions, but looks like the "desktop" Windows 11 SKU and supports Office apps. I'm running it on Azure VMs, built from the Microsoft-supplied Azure Marketplace images. Currently running version 23H2, but saw similar problems on I think 22H2 and 22H1 a while ago.

$ cmd.exe /c ver

Microsoft Windows [Version 10.0.22631.4112]

I've never encountered this problem on a regular non-Multi-Session Windows 10/11, or on Windows 10 Multi-Session, or Windows Server 2019 or 2022 (which corresponds to Win 11 Multi-Session). Only specifically Windows 11 Multi-Session.

VS Code as editor, "check out as-is, commit as-is", the rest defaults.

C:\Users\Andrew.Janke>type "C:\Program Files\Git\etc\install-options.txt"
Editor Option: VisualStudioCode
Custom Editor Path:
Default Branch Option:
Path Option: Cmd
SSH Option: OpenSSH
Tortoise Option: false
CURL Option: OpenSSL
CRLF Option: CRLFCommitAsIs
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 is all on VMs in Azure. I connect to them using the Microsoft Remote Desktop client app for Mac or the Windows RDP client, over a VPN to our private Azure network. My main client is a 27" 5K iMac and I usually run these RDP sessions in full screen with "Optimize for Retina display" (HiDPI mode) enabled, but have also seen it happen at smaller screen sizes and non-Retina resolution.

Details

Git bash. I sometimes use Git CMD, and have not seen it happen in Git CMD unless I have previously launched Git Bash in the same session.

This happens a bit after launching Git Bash by clicking the Git Bash icon in the Start Menu and waiting a bit. I don't necessarily have to run git or anything else in the bash window for it to freeze. Often it happens just when I hit return a couple times to get a fresh line in the bash session.

Or if it's when using SourceTree, it's sometimes when I click on a button or item in the GUI to switch branches or fetch or something like that. Or sometimes just seems to happen on its own while the GUI is up and I'm using other programs. I assume SourceTree is periodically calling git in the background to do something.

A normally-responsive Git Bash window and git commands in it running as usual.

The Git Bash window will come up, be responsive for a couple seconds, and then hang. Usually, the window is fully nonresponsive, not even responding to dragging the title bar or edges to move or resize it. When I hover the mouse cursor over the edges of the window, it doesn't change to the arrows-pointing-two-directions "drag me" cursor indicator. Can't close the window by clicking the X button in the upper right corner. But I can right-click on the Git Bash icon in the Task Bar and select "Close window" from the pop-up menu, and that will close it.

If I'm running SourceTree, the SourceTree GUI window will become partially or fully unresponsive.

And sometimes other GUI windows and elements, for other programs not related to Git, will also become unresponsive.

Occasionally, it's not the entire Git Bash window that becomes unresponsive, but just the "window chrome" like the title bar and edges. I can't move, close, or resize the window, but if I click in to the main area and type something, the bash session still responds.

No specific repository. Problem seems to sometimes happen without invoking a specific git operation. And when I've seen it hang while running a git command, it has happened on various internal repos at my work.

apjanke commented 2 weeks ago

After some more testing, I think my current problem here is the same one mentioned in https://github.com/git-for-windows/git/issues/4945 ("Git bash opens invisible window owned by system that blocks all foreground windows on Windows 11 multi-session"). But I'm not sure, because I'm not that good at Windows sysadminning. This might be a candidate for closing as a duplicate.

Don't know if it was the same problem a year or so back, because I didn't know about the conhost.exe problem, and didn't examine for that.