Git-Credential-Manager crashes in WSL2 in quake mode #20221

Closed
opened 2026-01-31 07:07:09 +00:00 by claunia · 11 comments
Owner

Originally created by @Nosamdaman on GitHub (Jul 12, 2023).

Windows Terminal version

1.17.11461.0

Windows build number

10.0.22621.0

Other Software

git-credential-manager 2.2.1
git 2.25.1
Ubuntu 20.04.6 LTS (via WSL2)

Steps to reproduce

  1. Open a Windows Terminal instance normally
  2. Launch Windows Terminal in quake mode using Win + `
  3. Close the original, normal terminal instance
  4. Open WSL2 Ubuntu in the quake mode instance
  5. Attempt any git action that requires remote authentication (ie git pull)

Expected Behavior

The pull should work without issue as it does when the terminal isn't in quake mode

Actual Behavior

git-credential-manager core crashes as follows:

>> git pull

Unhandled Exception: System.ComponentModel.Win32Exception: Only part of a ReadProcessMemory or WriteProcessMemory request was completed
   at System.Diagnostics.NtProcessManager.GetModuleInfos(Int32 processId, Boolean firstModuleOnly)
   at System.Diagnostics.NtProcessManager.GetFirstModuleInfo(Int32 processId)
   at System.Diagnostics.Process.get_MainModule()
   at GitCredentialManager.CommandContext.GetEntryApplicationPath()
   at GitCredentialManager.CommandContext..ctor()
   at GitCredentialManager.Program.AppMain(Object o)
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart(Object obj)
Username for '<LOCAL_GIT_SERVER>': ^C⏎    

Note that the shell prompt and hostname of our remote server have been removed for privacy reasons.
Originally created by @Nosamdaman on GitHub (Jul 12, 2023). ### Windows Terminal version 1.17.11461.0 ### Windows build number 10.0.22621.0 ### Other Software git-credential-manager 2.2.1 git 2.25.1 Ubuntu 20.04.6 LTS (via WSL2) ### Steps to reproduce 1. Open a Windows Terminal instance normally 2. Launch Windows Terminal in quake mode using ``` Win + ` ``` 3. Close the original, normal terminal instance 4. Open WSL2 Ubuntu in the quake mode instance 5. Attempt any git action that requires remote authentication (ie `git pull`) ### Expected Behavior The pull should work without issue as it does when the terminal isn't in quake mode ### Actual Behavior git-credential-manager core crashes as follows: ``` >> git pull Unhandled Exception: System.ComponentModel.Win32Exception: Only part of a ReadProcessMemory or WriteProcessMemory request was completed at System.Diagnostics.NtProcessManager.GetModuleInfos(Int32 processId, Boolean firstModuleOnly) at System.Diagnostics.NtProcessManager.GetFirstModuleInfo(Int32 processId) at System.Diagnostics.Process.get_MainModule() at GitCredentialManager.CommandContext.GetEntryApplicationPath() at GitCredentialManager.CommandContext..ctor() at GitCredentialManager.Program.AppMain(Object o) at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart(Object obj) Username for '<LOCAL_GIT_SERVER>': ^C⏎ Note that the shell prompt and hostname of our remote server have been removed for privacy reasons.
claunia added the Product-WSLIssue-BugNeeds-Tag-Fix labels 2026-01-31 07:07:09 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Jul 12, 2023):

This literally doesn't make any sense.

Like, I could theoretically understand if it was like, git.exe and it was doing something wacky with GetConsoleWindow. But it's not, it's the WSL git, so it doesn't care about the window.

BUT

Then look at that stack trace. That's like, all Win32 exceptions. So maybe gcm is set up to use the windows credentials inside of WSL.

I'd honestly start by filing this over at the WSL repo (https://github.com/microsoft/WSL). I'd bet this comes down to some sort of interop issue in that layer.

@zadjii-msft commented on GitHub (Jul 12, 2023): This literally doesn't make any sense. Like, I could theoretically understand if it was like, `git.exe` and it was doing something wacky with `GetConsoleWindow`. But it's not, it's the WSL git, so it doesn't care about the window. BUT Then look at that stack trace. That's like, all Win32 exceptions. So maybe gcm is set up to use the windows credentials inside of WSL. I'd honestly start by filing this over at the WSL repo (https://github.com/microsoft/WSL). I'd bet this comes down to some sort of interop issue in that layer.
Author
Owner

@Nosamdaman commented on GitHub (Jul 12, 2023):

I should clarify that this is a gcm instance in windows and git in wsl2, that I've set as my credential manager in wsl2. Furthermore, it works just fine, so long as the original wt instance that I used to spawn the quake mode instance still exists.

@Nosamdaman commented on GitHub (Jul 12, 2023): I should clarify that this is a gcm instance in windows and git in wsl2, that I've set as my credential manager in wsl2. Furthermore, it works just fine, so long as the original wt instance that I used to spawn the quake mode instance still exists.
Author
Owner

@DHowett commented on GitHub (Jul 12, 2023):

If you were to do this with two conhost windows (or "Windows Console Host"), where you start the session in one, close it, and try to use it in another, does it still happen?

@DHowett commented on GitHub (Jul 12, 2023): If you were to do this with two conhost windows (or "Windows Console Host"), where you start the session in one, close it, and try to use it in another, does it still happen?
Author
Owner

@Nosamdaman commented on GitHub (Jul 13, 2023):

If you were to do this with two conhost windows (or "Windows Console Host"), where you start the session in one, close it, and try to use it in another, does it still happen?

No, it doesn't happen. It also doesn't happen if I launch a new conhost from session from wt, or if I launch a new (standard) wt from wt. It only seems to happen in quake mode. It's also not entirely consistent. One time it did work fine, but most times, the issue crops up.

As to @zadjii-msft's earlier comment, it is indeed trying to read credentials from my Windows credential store. It's actually super convenient to have my git credentials stored securely there and have them be accessible both be git for windows and git in WSL2. I've been using it without issue for months, but I recently tried to integrate quake mode into my workflow, only for this issue to crop up.

I posted the issue to this repo instead of WSL2 or gcm because it seems like quake mode is the main thing causing the issue, though if ya'll think it's more of a WSL2 issue, I can certainly cross-post there.

@Nosamdaman commented on GitHub (Jul 13, 2023): > If you were to do this with two conhost windows (or "Windows Console Host"), where you start the session in one, close it, and try to use it in another, does it still happen? No, it doesn't happen. It also doesn't happen if I launch a new conhost from session from wt, or if I launch a new (standard) wt from wt. It only seems to happen in quake mode. It's also not entirely consistent. One time it did work fine, but most times, the issue crops up. As to @zadjii-msft's earlier comment, it is indeed trying to read credentials from my Windows credential store. It's actually super convenient to have my git credentials stored securely there and have them be accessible both be git for windows and git in WSL2. I've been using it without issue for months, but I recently tried to integrate quake mode into my workflow, only for this issue to crop up. I posted the issue to this repo instead of WSL2 or gcm because it seems like quake mode is the main thing causing the issue, though if ya'll think it's more of a WSL2 issue, I can certainly cross-post there.
Author
Owner

@zadjii-msft commented on GitHub (Jul 13, 2023):

Okay so here's an insane thought: Does it repro if you put a Terminal window into "Focus mode"? (There's an action in the command palette for "Toggle focus mode") That would be full insane if the actual HWND style mattered here.

I'm worried that like, something about the PATH is different in the window that's created for quake mode, vs the normal window.

@zadjii-msft commented on GitHub (Jul 13, 2023): Okay so here's an insane thought: Does it repro if you put a Terminal window into "Focus mode"? (There's an action in the command palette for "Toggle focus mode") That would be full insane if the actual HWND style mattered here. I'm worried that like, something about the PATH is different in the window that's created for quake mode, vs the normal window.
Author
Owner

@Nosamdaman commented on GitHub (Jul 13, 2023):

Okay so here's an insane thought: Does it repro if you put a Terminal window into "Focus mode"? (There's an action in the command palette for "Toggle focus mode") That would be full insane if the actual HWND style mattered here.

I'm worried that like, something about the PATH is different in the window that's created for quake mode, vs the normal window.

It works fine in focus mode if I activate focus mode in a normal terminal. However if do the "toggle focus mode" action in a quake mode window (thus seemingly making it a normal window), it still fails.

@Nosamdaman commented on GitHub (Jul 13, 2023): > Okay so here's an insane thought: Does it repro if you put a Terminal window into "Focus mode"? (There's an action in the command palette for "Toggle focus mode") That would be full insane if the actual HWND style mattered here. > > I'm worried that like, something about the PATH is different in the window that's created for quake mode, vs the normal window. It works fine in focus mode if I activate focus mode in a normal terminal. However if do the "toggle focus mode" action in a quake mode window (thus seemingly making it a normal window), it still fails.
Author
Owner

@zadjii-msft commented on GitHub (Jul 13, 2023):

Okay then yea I'd guess it's something else about how the new WT window is getting created.

What's $PATH set to in a window it works, vs one where it doesn't/?

@zadjii-msft commented on GitHub (Jul 13, 2023): Okay then yea I'd guess it's something else about how the new WT window is getting created. What's `$PATH` set to in a window it works, vs one where it doesn't/?
Author
Owner

@Nosamdaman commented on GitHub (Jul 13, 2023):

Okay then yea I'd guess it's something else about how the new WT window is getting created.

What's $PATH set to in a window it works, vs one where it doesn't/?

The paths are identical. It's worth noting that gcm isn't on my path either, it's specified in my WSL2 .gitconfig as follows:
image

@Nosamdaman commented on GitHub (Jul 13, 2023): > Okay then yea I'd guess it's something else about how the new WT window is getting created. > > What's `$PATH` set to in a window it works, vs one where it doesn't/? The paths are identical. It's worth noting that gcm isn't on my path either, it's specified in my WSL2 .gitconfig as follows: ![image](https://github.com/microsoft/terminal/assets/54364725/07c38fb2-6607-4019-93ed-c071c674bd53)
Author
Owner

@lhecker commented on GitHub (Aug 30, 2023):

It's a long shot, but could you try updating git and see if that changes anything? We're still a bit stumped on what could be causing this issue.

@lhecker commented on GitHub (Aug 30, 2023): It's a long shot, but could you try updating git and see if that changes anything? We're still a bit stumped on what could be causing this issue.
Author
Owner

@Nosamdaman commented on GitHub (Aug 31, 2023):

So it seems like I can no longer reproduce this issue .... strange. I'm happy closing it for now. Perhaps it was an issue with the OS itself?

@Nosamdaman commented on GitHub (Aug 31, 2023): So it seems like I can no longer reproduce this issue .... strange. I'm happy closing it for now. Perhaps it was an issue with the OS itself?
Author
Owner

@DHowett commented on GitHub (Aug 31, 2023):

Thanks for letting us know! That's pretty strange, but I'll take it!

If it comes back, don't hesitate to let us know 😄

@DHowett commented on GitHub (Aug 31, 2023): Thanks for letting us know! That's pretty strange, but I'll take it! If it comes back, don't hesitate to let us know :smile:
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20221