jesseduffield / jesseduffield/lazygit

Crash when sending move commands during start-up

Open
#3,321 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
82.4k
Forks
3k
Avg merge
2d 18h
Merged PRs (30d)
19

Description

**Describe the bug**
In Windows it take some time for lazygit to start-up. If one starts it and really quickly presses `h` or `l` to switch between panels the application crashes. It's 60-75% reproducible, I assume it's heavily tied to some timing. Always crashes in the same place - the stack trace is the same.

I tried to reproduce it on MacOS but failed. I think it's because the start-up time is way smaller and the issue still could occur, it's just humanly inpossible to execute it.

**To Reproduce**
Steps to reproduce the behavior:

1. write `lazygit` in your terminal
2. press `Enter` after which as soon as possible press `h` or `l`.

**Expected behavior**
No crash.

**Version info:**
```
commit=5e388e21c8ca6aa883dbcbe45c47f6fdd5116815, build date=2023-08-07T14:05:48Z, build source=binaryRelease, version=0.40.2, os=windows, arch=amd64, git version=2.43.0.windows.1
git version 2.43.0.windows.1
```

**Additional context**

The stack trace
```
goroutine 1 [running]:
github.com/jesseduffield/lazygit/pkg/gui/context.(*ListViewModel[...]).GetSelected(0xb06f60)
/home/runner/work/lazygit/lazygit/pkg/gui/context/list_view_model.go:29 +0x6c
github.com/jesseduffield/lazygit/pkg/gui/context.NewLocalCommitsContext.func2(0xffffffffffffffff?, 0x98?)
/home/runner/work/lazygit/lazygit/pkg/gui/context/local_commits_context.go:34 +0xa5
github.com/jesseduffield/lazygit/pkg/gui/context.(*ListContextTrait).refreshViewport(0xc00024bcc0)
/home/runner/work/lazygit/lazygit/pkg/gui/context/list_context_trait.go:51 +0x47
github.com/jesseduffield/lazygit/pkg/gui/context.(*ListContextTrait).FocusLine(0xc00024bcc0)
/home/runner/work/lazygit/lazygit/pkg/gui/context/list_context_trait.go:45 +0x87
github.com/jesseduffield/lazygit/pkg/gui/context.(*ListContextTrait).HandleFocus(0xc00024bcc0, {{0x0?, 0xc000093308?}, 0xc00042c180?})
/home/runner/work/lazygit/lazygit/pkg/gui/context/list_context_trait.go:65 +0x36
github.com/jesseduffield/lazygit/pkg/gui.(*ContextMgr).ActivateContext(0xc0000e4300, {0xb1f1e8, 0xc000093308}, {{0x0?, 0x1?}, 0xc0002eb2f0?})
/home/runner/work/lazygit/lazygit/pkg/gui/context.go:250 +0x20e
github.com/jesseduffield/lazygit/pkg/gui.(*ContextMgr).Push(0xc0000d92d0?, {0xb1f1e8, 0xc000093308}, {0x0?, 0x9ccf16?, 0x7?})
/home/runner/work/lazygit/lazygit/pkg/gui/context.go:86 +0x1c7
github.com/jesseduffield/lazygit/pkg/gui.(*guiCommon).PushContext(0xc00020fb20?, {0xb1f1e8?, 0xc000093308?}, {0x0?, 0xc0002eb3f8?, 0x127613?})
/home/runner/work/lazygit/lazygit/pkg/gui/gui_common.go:44 +0x33
github.com/jesseduffield/lazygit/pkg/gui/controllers.(*SideWindowController).previousSideWindow(0xc0000080d8)
/home/runner/work/lazygit/lazygit/pkg/gui/controllers/side_window_controller.go:72 +0x1e3
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).SetKeybinding.func2(0x0?, 0xc0002eb480?)
/home/runner/work/lazygit/lazygit/pkg/gui/keybindings.go:373 +0x1b
github.com/jesseduffield/gocui.(*Gui).execKeybinding(0xc0002eb4e8?, 0x11e1e8?, 0xc00083e000?)
/home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:1424 +0x59
github.com/jesseduffield/gocui.(*Gui).execKeybindings(0xc0004321a0, 0xc000015680, 0xc0002eb648)
/home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:1392 +0x451
github.com/jesseduffield/gocui.(*Gui).onKey(0xc00042c058?, 0xc0002eb568?)
/home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:1249 +0xf7
github.com/jesseduffield/gocui.(*Gui).handleEvent(0xc00042c030?, 0xc0002eb5c8?)
/home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:798 +0x4a
github.com/jesseduffield/gocui.(*Gui).processEvent(0xc0004321a0)
/home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:752 +0x20b
github.com/jesseduffield/gocui.(*Gui).MainLoop(0xc0004321a0)
/home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:739 +0xa5
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).Run(0xc0000db8c0, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}})
/home/runner/work/lazygit/lazygit/pkg/gui/gui.go:669 +0x5e5
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).RunAndHandleError.func1()
/home/runner/work/lazygit/lazygit/pkg/gui/gui.go:675 +0x4c
github.com/jesseduffield/lazygit/pkg/utils.SafeWithError(0x0?)
/home/runner/work/lazygit/lazygit/pkg/utils/utils.go:108 +0x67
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).RunAndHandleError(0xc0000db8c0, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}})
/home/runner/work/lazygit/lazygit/pkg/gui/gui.go:674 +0xd4
github.com/jesseduffield/lazygit/pkg/app.(*App).Run(...)
/home/runner/work/lazygit/lazygit/pkg/app/app.go:263
github.com/jesseduffield/lazygit/pkg/app.Run({0xb19a70?, 0xc000230960?}, 0xc000252540, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}})
/home/runner/work/lazygit/lazygit/pkg/app/app.go:48 +0xe9
github.com/jesseduffield/lazygit/pkg/app.Start(0xc0000c9f30, {0x0, 0x0})
/home/runner/work/lazygit/lazygit/pkg/app/entry_point.go:150 +0xd26
main.main()
/home/runner/work/lazygit/lazygit/main.go:23 +0x9e
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.