Skip to content

panic: gocui: userEvents channel full; refusing to block or reorder #5772

Closed

Description

@rokkerruslan

Describe the bug

Panic

To Reproduce

Steps to reproduce the behavior:

  1. $ lazygit
  2. Press 1
  3. Press e
  4. Close editor

Expected behavior

Program must work

Screenshots

 ~/w/udf $ lazygit

+ /bin/zsh -c hx -- "/Users/rrokker/Library/Application Support/lazygit/config.yml"


Press enter to return to lazygit
panic: gocui: userEvents channel full; refusing to block or reorder

goroutine 370 [running]:
github.com/jesseduffield/lazygit/pkg/gocui.(*Gui).Update(0x367bec2d01e0, 0x367bed01b440)
        /Users/rrokker/go/pkg/mod/github.com/jesseduffield/lazygit@v0.63.0/pkg/gocui/gui.go:636 +0x80
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).onUIThread(...)
        /Users/rrokker/go/pkg/mod/github.com/jesseduffield/lazygit@v0.63.0/pkg/gui/gui.go:1187
github.com/jesseduffield/lazygit/pkg/gui.(*guiCommon).OnUIThread(0x20?, 0x367bec5bf4e0)
        /Users/rrokker/go/pkg/mod/github.com/jesseduffield/lazygit@v0.63.0/pkg/gui/gui_common.go:124 +0x7c
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).refreshView(...)
        /Users/rrokker/go/pkg/mod/github.com/jesseduffield/lazygit@v0.63.0/pkg/gui/controllers/helpers/refresh_helper.go:1003
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).refreshStashEntries(0x367bec6a8960)
        /Users/rrokker/go/pkg/mod/github.com/jesseduffield/lazygit@v0.63.0/pkg/gui/controllers/helpers/refresh_helper.go:960 +0x134
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).Refresh.func2.10()
        /Users/rrokker/go/pkg/mod/github.com/jesseduffield/lazygit@v0.63.0/pkg/gui/controllers/helpers/refresh_helper.go:212 +0x20
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).Refresh.func2.1.1({0x367bec0b4000?, 0x33c85e994f60?})
        /Users/rrokker/go/pkg/mod/github.com/jesseduffield/lazygit@v0.63.0/pkg/gui/controllers/helpers/refresh_helper.go:148 +0x24
github.com/jesseduffield/lazygit/pkg/gocui.(*Gui).onWorkerAux(0x367bec2d01e0, 0x40ec284000000000?, {0x101d65cf8?, 0x367bec7841c0?})
        /Users/rrokker/go/pkg/mod/github.com/jesseduffield/lazygit@v0.63.0/pkg/gocui/gui.go:668 +0x68
github.com/jesseduffield/lazygit/pkg/gocui.(*Gui).OnWorker.func1()
        /Users/rrokker/go/pkg/mod/github.com/jesseduffield/lazygit@v0.63.0/pkg/gocui/gui.go:655 +0x30
created by github.com/jesseduffield/lazygit/pkg/gocui.(*Gui).OnWorker in goroutine 1
        /Users/rrokker/go/pkg/mod/github.com/jesseduffield/lazygit@v0.63.0/pkg/gocui/gui.go:654 +0x90

Version info:

  • Run lazygit --version and paste the result here
$ lazygit --version
commit=, build date=, build source=unknown, version=unversioned, os=darwin, arch=arm64, git version=2.50.1 (Apple Git-155)

Terminal info:

What terminal are you using, and which version? For some types of bugs this information can be relevant.

Wave Terminal
Open-Source AI-Integrated Terminal
Built for Seamless Workflows
Client Version 0.14.5 (202604161535)
Update Channel: latest

Additional context

Add any other context about the problem here.

Note

Please try updating to the latest version or manually building the latest master to see if the issue still occurs.

Activity

  1. stefanhaller commented on Jul 8, 2026

    @stefanhaller
    Collaborator

    Is this actually reproducible, or does it happen intermittently? If you do those four steps, does it happen every time? I'm asking because I can't reproduce it that way. (Even when setting my editor preset to vim so that it suspends to the terminal like yours did.)

    I'm very interested in tracking this down; this was a change in 0.63 that I felt slightly uncomfortable with, so if there's any more information you can provide on this, that would be great.

  2. Schuasda commented on Jul 9, 2026

    @Schuasda

    I have the same bug. I don't know exactly how I can reliably reproduce it, but i think it happens most often when changing views to/from staged files. Either by going up/down in the Files-panel or going left/right to other panels.
    lazygit freezes for quite a while, maybe 1-2 minutes, then i get the same error with a similar stack trace

    I am using windows terminal, with Powershell 7.6.3 (idk if relevant), on Windows 11
    lazygit version
    commit=ce5a8b61bdc9439f2137a1ce9c6a5981c412a0ad, build date=2026-07-04T12:45:51Z, build source=binaryRelease, version=0.63.0, os=windows, arch=amd64, git version=2.53.0.windows.2

    I did recently upgrade lazygit (i think from 0.62) and I don't remember seeing this crash happen before that

    EDIT: I just realized that the original issue was specifically describing editing the config from panel[1]. This works fine in my case and i can not reproduce OP's bug.

    console output after crash:

    panic: gocui: userEvents channel full; refusing to block or reorder
    
    goroutine 1596 [running]:
    github.com/jesseduffield/lazygit/pkg/gocui.(*Gui).Update(0xc000148000, 0xc0005060d0)
            /home/runner/work/lazygit/lazygit/pkg/gocui/gui.go:636 +0x78
    github.com/jesseduffield/lazygit/pkg/gui.(*Gui).onUIThread(...)
            /home/runner/work/lazygit/lazygit/pkg/gui/gui.go:1187
    github.com/jesseduffield/lazygit/pkg/gui.(*guiCommon).OnUIThread(0xc00013a288?, 0xc001206060)
            /home/runner/work/lazygit/lazygit/pkg/gui/gui_common.go:124 +0x67
    github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).refreshView(...)
            /home/runner/work/lazygit/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:1003
    github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).refreshTags(0xc00040a300)
            /home/runner/work/lazygit/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:660 +0x147
    github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).Refresh.func2.11()
            /home/runner/work/lazygit/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:216 +0x17
    github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).Refresh.func2.1.2()
            /home/runner/work/lazygit/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:156 +0xae
    github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).Refresh.func2.1.gowrap1.Safe.1()
            /home/runner/work/lazygit/lazygit/pkg/utils/utils.go:70 +0x13
    github.com/jesseduffield/lazygit/pkg/utils.SafeWithError(0xc00029bfd0?)
            /home/runner/work/lazygit/lazygit/pkg/utils/utils.go:81 +0x56
    github.com/jesseduffield/lazygit/pkg/utils.Safe(...)
            /home/runner/work/lazygit/lazygit/pkg/utils/utils.go:70
    created by github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).Refresh.func2.1 in goroutine 1572
            /home/runner/work/lazygit/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:153 +0x136
    
  3. stefanhaller commented on Jul 9, 2026

    @stefanhaller
    Collaborator

    @Schuasda Is the freezing of 1-2 minutes also new with 0.63, or did you see this before too?

    If the main thread blocks for such a long time, then I can see how the userEvents channel overflows easily. We refresh the Files panel every 10s, causing several user events to be posted to the userEvents channel, and if they can't be serviced by the main thread then you get the panic. I can reproduce this by adding a time.Sleep of a few minutes into a command handler.

    This doesn't explain @rokkerruslan's scenario; we pause background refreshes when suspending to the terminal.

  4. Schuasda commented on Jul 9, 2026

    @Schuasda

    I don't remember seeing it that often, but I also only recently switched 100% to using lazygit.
    Do you have any idea of what causes the main thread to block for so long? Can I change something about my setup or assist you in finding the problem?

  5. stefanhaller commented on Jul 10, 2026

    @stefanhaller
    Collaborator

    @rokkerruslan @Schuasda Here's a fix, can you please test this thoroughly: #5793. I'd like to release a patch update soon (Sunday or early next week).

    Do you have any idea of what causes the main thread to block for so long?

    No, this is not normal. You could run with -debug and send the log, maybe it shows it.

  6. Schuasda commented on Jul 13, 2026

    @Schuasda

    I didn't get to it earlier, but today i pulled your PR and installed that version.
    Unfortunately i quickly reproduced the same bug as before. Some additional findings I have:
    I can quite reliably reproduce the bug by going to the branches pane and quickly going up/down through the branches. This first produces the bug I described in #5783 . When I then go back to the files pane (with some staged and some unstaged changes), I just need to go up/down the files list a bit and the whole GUI freezes, crashing to the console output we've seen before.

    I ran lazygit --debug as well this time, this was the output:

    POTENTIAL DEADLOCK:
    Previous place where the lock was grabbed
    goroutine 124 lock 0x399ef2d67718
    ..\lazygit\pkg\tasks\tasks.go:460 tasks.(*ViewBufferManager).NewTask.func2 { // may have arrived while we were blocked here. } <<<<<
    ..\lazygit\pkg\tasks\tasks.go:456 tasks.(*ViewBufferManager).NewTask.func2 {  }
    ..\lazygit\pkg\utils\utils.go:69 tasks.(*ViewBufferManager).NewTask.gowrap1.Safe.1 { func Safe(f func()) { }
    ..\lazygit\pkg\utils\utils.go:82 utils.SafeWithError {  }
    ..\lazygit\pkg\tasks\tasks.go:435 tasks.(*ViewBufferManager).NewTask.gowrap1 {  }
    
    Have been trying to lock it again for more than 30s
    goroutine 125 lock 0x399ef2d67718
    ..\lazygit\pkg\tasks\tasks.go:460 tasks.(*ViewBufferManager).NewTask.func2 { // may have arrived while we were blocked here. } <<<<<
    ..\lazygit\pkg\tasks\tasks.go:456 tasks.(*ViewBufferManager).NewTask.func2 {  }
    ..\lazygit\pkg\utils\utils.go:69 tasks.(*ViewBufferManager).NewTask.gowrap1.Safe.1 { func Safe(f func()) { }
    ..\lazygit\pkg\utils\utils.go:82 utils.SafeWithError {  }
    ..\lazygit\pkg\tasks\tasks.go:435 tasks.(*ViewBufferManager).NewTask.gowrap1 {  }
    
    Here is what goroutine 124 doing now
    goroutine 124 [chan receive]:
    github.com/jesseduffield/lazygit/pkg/tasks.(*ViewBufferManager).NewTask.func2.1()
            D:/dev/lazygit/pkg/tasks/tasks.go:481 +0x31
    sync.(*Once).doSlow(0x7ff643d24760?, 0x399ef2d67720?)
            C:/Program Files/Go/src/sync/once.go:78 +0xac
    sync.(*Once).Do(...)
            C:/Program Files/Go/src/sync/once.go:69
    github.com/jesseduffield/lazygit/pkg/tasks.(*ViewBufferManager).NewTask.func2.2()
            D:/dev/lazygit/pkg/tasks/tasks.go:484 +0x25
    github.com/jesseduffield/lazygit/pkg/tasks.(*ViewBufferManager).NewTask.func2()
            D:/dev/lazygit/pkg/tasks/tasks.go:470 +0x20a
    github.com/jesseduffield/lazygit/pkg/tasks.(*ViewBufferManager).NewTask.gowrap1.Safe.1()
            D:/dev/lazygit/pkg/utils/utils.go:70 +0x13
    github.com/jesseduffield/lazygit/pkg/utils.SafeWithError(0x399ef3591fd0?)
            D:/dev/lazygit/pkg/utils/utils.go:81 +0x56
    github.com/jesseduffield/lazygit/pkg/utils.Safe(...)
            D:/dev/lazygit/pkg/utils/utils.go:70
    created by github.com/jesseduffield/lazygit/pkg/tasks.(*ViewBufferManager).NewTask in goroutine 1
            D:/dev/lazygit/pkg/tasks/tasks.go:436 +0x1d6
    
    Other goroutines holding locks:
    goroutine 647 lock 0x399ef307c0e4
    ..\lazygit\pkg\gui\pty.go:114 gui.(*Gui).newPtyTask.func1.2 { gui.Mutexes.PtyMutex.Lock() } <<<<<
    ..\lazygit\pkg\gui\pty.go:113 gui.(*Gui).newPtyTask.func1.2 { onClose := func() { }
    C:/Program Files/Go/src/sync/once.go:76 sync.(*Once).doSlow { if !o.done.Load() { }
    C:/Program Files/Go/src/sync/once.go:70 sync.(*Once).Do { } }
    ..\lazygit\pkg\tasks\tasks.go:154 gui.(*Gui).newPtyTask.func1.(*ViewBufferManager).NewCmdTask.4.2 { } }
    ..\lazygit\pkg\tasks\tasks.go:202 gui.(*Gui).newPtyTask.func1.(*ViewBufferManager).NewCmdTask.4.3 { } }
    ..\lazygit\pkg\utils\utils.go:69 utils.Safe.func1 { func Safe(f func()) { }
    ..\lazygit\pkg\utils\utils.go:82 utils.SafeWithError {  }
    ..\lazygit\pkg\utils\utils.go:70 utils.Safe { _ = SafeWithError(func() error { f(); return nil }) }
    

    lazygit --version:

    commit=220368b7f42357be33768ee198874dfd1e478d56, build date=2026-07-10T12:30:24Z, build source=unknown, version=220368b7, os=windows, arch=amd64, git version=2.53.0.windows.2
    
  7. stefanhaller commented on Jul 13, 2026

    @stefanhaller
    Collaborator

    Unfortunately i quickly reproduced the same bug as before.
    crashing to the console output we've seen before.

    I can't believe this, assuming you mean the bug originally reported in this issue (i.e. the "userEvents channel full; refusing to block or reorder" panic). This code is no longer present in the branch you are testing.

    Sorry for the deadlocks that you are running into; I'm fairly confident that those will be fixed in the next release. I've been making lots of changes to lazygit's concurrency system recently. Unfortunately I can't ship any of this as a v0.63.1 patch release, since the changes are too entangled with other stuff that has changed on master and that I can't release just yet.

  8. Schuasda commented on Jul 13, 2026

    @Schuasda

    Ah sorry for the confusion. I think I saw the output again while still using the released 0.63.0 version.
    With the PR, while not using the debug flag, lazygit just freezes. The way to reproduce the bug is still accurate though.
    I just thought I had already installed the dev-version when I saw the output again. Sorry again

    I think i can work with the released version, or actually simply rollback to 62. So the fixes will probably come with a v64 at some point?

  9. rokkerruslan commented on Jul 14, 2026

    @rokkerruslan
    Author

    Sorry for the late reply. I reproduced the issue three times in a row before opening the issue. But now I can't, even though I'm using the same build.

    I don't even know what to say, I was sure there was a bug :)

  10. stefanhaller commented on Jul 14, 2026

    @stefanhaller
    Collaborator

    @Schuasda I pushed another commit to #5793 that should hopefully address the deadlocks you were seeing. Can you please test this? If it works, I might release a patch update later this week.

  11. Schuasda commented on Jul 14, 2026

    @Schuasda

    To my eyes there seems no change, unfortunately. I hope I am doing the pull and manual install steps correctly ??
    I do uninstall the normal version with winget (how I also installed it) and lazygit --version output seems logical to me:

    commit=3dd0e2d5c15db6bbbadfeae4c1693b7d6025f039, build date=2026-07-14T12:03:44Z, build source=unknown, version=3dd0e2d5, os=windows, arch=amd64, git version=2.53.0.windows.2
    

    But i still get the deadlock error when running lazygit --debug:

    POTENTIAL DEADLOCK:
    Previous place where the lock was grabbed
    goroutine 290 lock 0x3dd7bc69d698
    ..\lazygit\pkg\tasks\tasks.go:460 tasks.(*ViewBufferManager).NewTask.func2 { // may have arrived while we were blocked here. } <<<<<
    ..\lazygit\pkg\tasks\tasks.go:456 tasks.(*ViewBufferManager).NewTask.func2 {  }
    ..\lazygit\pkg\utils\utils.go:69 tasks.(*ViewBufferManager).NewTask.gowrap1.Safe.1 { func Safe(f func()) { }
    ..\lazygit\pkg\utils\utils.go:82 utils.SafeWithError {  }
    ..\lazygit\pkg\tasks\tasks.go:435 tasks.(*ViewBufferManager).NewTask.gowrap1 {  }
    
    Have been trying to lock it again for more than 30s
    goroutine 159 lock 0x3dd7bc69d698
    ..\lazygit\pkg\tasks\tasks.go:460 tasks.(*ViewBufferManager).NewTask.func2 { // may have arrived while we were blocked here. } <<<<<
    ..\lazygit\pkg\tasks\tasks.go:456 tasks.(*ViewBufferManager).NewTask.func2 {  }
    ..\lazygit\pkg\utils\utils.go:69 tasks.(*ViewBufferManager).NewTask.gowrap1.Safe.1 { func Safe(f func()) { }
    ..\lazygit\pkg\utils\utils.go:82 utils.SafeWithError {  }
    ..\lazygit\pkg\tasks\tasks.go:435 tasks.(*ViewBufferManager).NewTask.gowrap1 {  }
    
    Here is what goroutine 290 doing now
    goroutine 290 [chan receive]:
    github.com/jesseduffield/lazygit/pkg/tasks.(*ViewBufferManager).NewTask.func2.1()
            D:/dev/lazygit/pkg/tasks/tasks.go:481 +0x31
    sync.(*Once).doSlow(0x7ff797fa4740?, 0x3dd7bc69d6a0?)
            C:/Program Files/Go/src/sync/once.go:78 +0xac
    sync.(*Once).Do(...)
            C:/Program Files/Go/src/sync/once.go:69
    github.com/jesseduffield/lazygit/pkg/tasks.(*ViewBufferManager).NewTask.func2.2()
            D:/dev/lazygit/pkg/tasks/tasks.go:484 +0x25
    github.com/jesseduffield/lazygit/pkg/tasks.(*ViewBufferManager).NewTask.func2()
            D:/dev/lazygit/pkg/tasks/tasks.go:470 +0x20a
    github.com/jesseduffield/lazygit/pkg/tasks.(*ViewBufferManager).NewTask.gowrap1.Safe.1()
            D:/dev/lazygit/pkg/utils/utils.go:70 +0x13
    github.com/jesseduffield/lazygit/pkg/utils.SafeWithError(0x0?)
            D:/dev/lazygit/pkg/utils/utils.go:81 +0x56
    github.com/jesseduffield/lazygit/pkg/utils.Safe(...)
            D:/dev/lazygit/pkg/utils/utils.go:70
    created by github.com/jesseduffield/lazygit/pkg/tasks.(*ViewBufferManager).NewTask in goroutine 1
            D:/dev/lazygit/pkg/tasks/tasks.go:436 +0x1d6
    Other goroutines holding locks:
    goroutine 283 lock 0x3dd7bc67e9e4
    ..\lazygit\pkg\gui\pty.go:114 gui.(*Gui).newPtyTask.func1.2 { gui.Mutexes.PtyMutex.Lock() } <<<<<
    ..\lazygit\pkg\gui\pty.go:113 gui.(*Gui).newPtyTask.func1.2 { onClose := func() { }
    C:/Program Files/Go/src/sync/once.go:76 sync.(*Once).doSlow { if !o.done.Load() { }
    C:/Program Files/Go/src/sync/once.go:70 sync.(*Once).Do { } }
    ..\lazygit\pkg\tasks\tasks.go:154 gui.(*Gui).newPtyTask.func1.(*ViewBufferManager).NewCmdTask.4.2 { } }
    ..\lazygit\pkg\tasks\tasks.go:202 gui.(*Gui).newPtyTask.func1.(*ViewBufferManager).NewCmdTask.4.3 { } }
    ..\lazygit\pkg\utils\utils.go:69 utils.Safe.func1 { func Safe(f func()) { }
    ..\lazygit\pkg\utils\utils.go:82 utils.SafeWithError {  }
    ..\lazygit\pkg\utils\utils.go:70 utils.Safe { _ = SafeWithError(func() error { f(); return nil }) }
    

    Without debug flag it just freezes indefinitely (at least 20-30 minutes, after that I usually close the Terminal tab)
    I don't know if my config is super weird for some reason, here it is for good measure:

    lazygit/config.yml
    os:
      editPreset: 'nvim'
    git:
      pagers:
        - pager: delta --paging=never --hyperlinks --hyperlinks-file-link-format="lazygit-edit://{path}:{line}" 
        - externalDiffCommand: difft --color=always --display=inline
        - {}
    
    gui:
      expandFocusedSidePanel: false
      skipDiscardChangeWarning: true
      theme:
        activeBorderColor:
          - '#a6e3a1'
          - bold
        inactiveBorderColor:
          - '#a6adc8'
        searchingActiveBorderColor:
          - '#f9e2af'
        optionsTextColor:
          - '#89b4fa'
        selectedLineBgColor:
          - '#313244'
        inactiveViewSelectedLineBgColor:
          - '#6c7086'
        cherryPickedCommitFgColor:
          - '#a6e3a1'
        cherryPickedCommitBgColor:
          - '#45475a'
        markedBaseCommitFgColor:
          - '#89b4fa'
        markedBaseCommitBgColor:
          - '#f9e2af'
        unstagedChangesColor:
          - '#f38ba8'
        defaultFgColor:
          - '#cdd6f4'
    
      authorColors:
        '*': '#b4befe'
    
    keybinding:
      universal:
        nextTab: '#'
        prevTab: 'ä'
  12. stefanhaller commented on Jul 14, 2026

    @stefanhaller
    Collaborator

    @Schuasda Thanks for your patience testing this. I have pushed one more commit for you to try: daffec1.

  13. Schuasda commented on Jul 14, 2026

    @Schuasda

    Who else is gonna do it, when I have this problem? :D
    And I think it worked! I can jump around all panels and never make lazygit freeze up.

    I am looking forward to the next release 😁

  14. added a commit that references this issue on Jul 15, 2026
    c2489e1
  15. stefanhaller commented on Jul 15, 2026

    @stefanhaller
    Collaborator

    Fixed by #5793

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