Visitar URL original
Orphans on Windows · Issue #5879 · jesseduffield/lazygit · GitHub
Skip to content

Orphans on Windows #5879

Closed
Closed

Description

@NickGaertner

Describe the bug

lazygit creates many orphans on Windows. The orphans contain many instances (triple digits) of conhost.exe, git.exe and difft.exe (my secondary pager). The difft processes are suspended, while the others are not but don't consume any CPU.

Possibly related to #5675

To Reproduce

I only know how to reliably create the difft and conhost orphans.

  1. Configure difft as a pager (externalDiffCommand: difft --color=always)
  2. Open lazygit and select difft as a pager.
  3. Quickly select different commits. In my case, difft is too slow to render each diff.
  4. A handful of suspended difft orphans appear. Also a few conhost processes are spawned. They are displayed as children of the lazygit process in process explorer but remain alive after I exit lazygit. The conhost orphans also appear if I use a different pager (e.g. delta).

Expected behavior

No orphans.

Screenshots

Initial state - lazygit

Image

After rapidly selecting different commits

Image

After exiting lazygit

Image

Version info:

commit=aafe61082e7ed383d318fd40e48f85645e6afc7b, build date=2026-07-15T11:34:26Z, build source=binaryRelease, version=0.63.1, os=windows, arch=amd64, git version=2.55.0.windows.3

Terminal info:

I'm on windows 11 using pwsh 7.6.4 inside of Windows Terminal 1.24.11911.0.

Activity

  1. stefanhaller commented on Aug 2, 2026

    @stefanhaller
    Collaborator

    @NickGaertner Here's a fix, can you test this please?

    I'd like to cut a new release tomorrow, so if you could get around to testing it until then, this would be great.

  2. NickGaertner commented on Aug 3, 2026

    @NickGaertner
    Author

    @stefanhaller Thanks for addressing the issue so quickly! I just tested the fix (fa5de1b) and unfortunately the conhost.exe orphans still persist. That said, I wasn't able to produce any git.exe or difft.exe orphans.
    Please let me know if I can provide you with any additional information.

  3. stefanhaller commented on Aug 3, 2026

    @stefanhaller
    Collaborator

    I can't reproduce conhost.exe orphans on my machine (neither can Claude with a test harness).

    Could you answer a few more questions please:

    1. What's your Windows build number? (Type ver in a cmd window to find out.)
    2. After reproducing, could you paste the output of
      Get-CimInstance Win32_Process -Filter "name='conhost.exe'" |
        Select-Object ProcessId,ParentProcessId,CreationDate,CommandLine
      
    3. Do you get roughly one leaked conhost per fast keypress, or only occasionally after a burst of fast navigation? Does slow navigation (pausing a second on each commit) leak too?
    4. Persistence: do the leaked conhosts ever disappear on their own (check again after ~10 minutes)?
  4. NickGaertner commented on Aug 3, 2026

    @NickGaertner
    Author
    1. Microsoft Windows [Version 10.0.22631.6199]
    2.    ProcessId ParentProcessId CreationDate        CommandLine
         --------- --------------- ------------        -----------
              7124            7136 03/08/2026 12:30:09
              6760            6276 03/08/2026 12:30:09
              7176            7116 03/08/2026 12:30:09
              7204            6948 03/08/2026 12:30:09
              7284            7188 03/08/2026 12:30:09
             15696           20096 03/08/2026 12:48:05 \\?\C:\Windows\system32\conhost.exe --headless --width 106 --height 54 --signal 0x63c --server 0x688
             14440           20096 03/08/2026 12:48:05 \\?\C:\Windows\system32\conhost.exe --headless --width 106 --height 54 --signal 0x690 --server 0x614
             11580           20096 03/08/2026 12:51:08 \\?\C:\Windows\system32\conhost.exe --headless --width 106 --height 54 --signal 0x6e0 --server 0x6e8
      • Not every single keypress causes a leak. For example, after quickly selecting 10 commits in a row I had two leftover conhost processes.
      • I couldn't observe any leaks during slow navigation.
    3. The leaked processes don't disappear on their own.

    Additional info
    I'm currently on a different machine than I was when I originally wrote the issue:

    • PowerShell: 7.6.3
    • git: 2.44.0.windows.1
    • Windows Terminal: 1.24.11911.0
    • lazygit: running fa5de1b from a checkout via go run .\main.go
  5. stefanhaller commented on Aug 3, 2026

    @stefanhaller
    Collaborator

    Thanks; I pushed a fixup to the branch that may or may not change things, could you please test again?

  6. NickGaertner commented on Aug 3, 2026

    @NickGaertner
    Author

    I re-tested with e7c42cf but it didn't make a difference.

  7. stefanhaller commented on Aug 3, 2026

    @stefanhaller
    Collaborator

    I re-tested with e7c42cf but it didn't make a difference.

    Ok, that was to be expected after all.

    I reworked the branch to include a fix for the conhost orphans too. That was a different bug; the first one was really ours, but this one is a Windows bug that only occurs on older Windows versions. I added a workaround for it, so the orphans should be gone.

    While working on this I discovered another problem: the index.lock problems that we fixed long ago could have been reintroduced with the PTY support. I don't think we have any reports for this yet, but that's probably just a matter of time. I made a separate PR to fix these (#5888); the PR you are testing is stacked on it, so it includes those fixes.

    Can you retest again please? In addition to the flick-through-commits-quickly test, it would be useful to test the behavior of quitting lazygit while a very long diff is showing.

  8. NickGaertner commented on Aug 3, 2026

    @NickGaertner
    Author

    That seemed to do the trick. I tried to quickly switch commits and quit during diff calculation and wasn't able to create any orphans :) Thank you for your work!

  9. added a commit that references this issue on Aug 4, 2026
    ccdfa8f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions