termui crashed while trying to add a label to a bug. I've added about 100 or so bugs and pushed/pulled about 5 or 6 times since creating the repository a couple of days ago... and this is the first time I got this crash... so I'm not sure how common of a case it is.
I'm not sure if this is helpful information, but the text of the error message below was printed about 1/2 way down the list of labels. Hopefully the error message is enough to narrow in on the code line. I wish I had also grabbed a screenshot to illustrate.
I'm using the linux-amd64 binary from the 0.5.0 release on github.
panic: runtime error: slice bounds out of range
[ ] json
goroutine 36 [running]:
github.com/MichaelMure/git-bug/vendor/github.com/nsf/termbox-go.PollEvent(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/travis/gopath/src/github.com/MichaelMure/git-bug/vendor/github.com/nsf/termbox-go/api.go:348 +0x8d4
github.com/MichaelMure/git-bug/vendor/github.com/MichaelMure/gocui.(*Gui).MainLoop.func1(0xc000290000)
/home/travis/gopath/src/github.com/MichaelMure/git-bug/vendor/github.com/MichaelMure/gocui/gui.go:354 +0x30
created by github.com/MichaelMure/git-bug/vendor/github.com/MichaelMure/gocui.(*Gui).MainLoop
/home/travis/gopath/src/github.com/MichaelMure/git-bug/vendor/github.com/MichaelMure/gocui/gui.go:352 +0x6e
That's a though one to debug ... This is happening in termbox, the low level access to the terminal, when being called by gocui, the library we use to draw the termui. As you can see, the stacktrace doesn't even mention git-bug's own code, which means it's happening either because of a bad state created by git-bug, or a bug in gocui or termbox.
Could you try to reproduce with GOTRACEBACK=all set ? This should dump the stracktrace of all the goroutines, maybe there is something in there.
github.com/MichaelMure/git-bug/termui.(*bugTable).changeQuery(0xc4200cc540, 0xc4202f0000, 0xc4204d85a0, 0xc4200cc600, 0xc4200cc600) C:1 L:1 3 days ago
0dd8d1a/home/josh/go/src/github.com/MichaelMure/git-bug/termui/bug_table.go:533 +0x2b Josh Bialkowski C:1 L:1 3 days ago
github.com/MichaelMure/git-bug/termui.(*bugTable).(github.com/MichaelMure/git-bug/termui.changeQuery)-fm(0xc4202f0000, 0xc4204d85a0, 0xc, 0xc420349b01)days ago
12fc493/home/josh/go/src/github.com/MichaelMure/git-bug/termui/bug_table.go:209 +0x3e Josh Bialkowski C:1 L:1 4 days ago
github.com/MichaelMure/git-bug/vendor/github.com/MichaelMure/gocui.(*Gui).execKeybindings(0xc4202f0000, 0xc4204d85a0, 0xc420349a90, 0x855759, 0x0, 0x0)days ago
/home/josh/go/src/github.com/MichaelMure/git-bug/vendor/github.com/MichaelMure/gocui/gui.go:629 +0xce
github.com/MichaelMure/git-bug/vendor/github.com/MichaelMure/gocui.(*Gui).onKey(0xc4202f0000, 0xc420349a90, 0xc4200dc800, 0xc4202a0ca0)
/home/josh/go/src/github.com/MichaelMure/git-bug/vendor/github.com/MichaelMure/gocui/gui.go:593 +0x1b3
github.com/MichaelMure/git-bug/vendor/github.com/MichaelMure/gocui.(*Gui).handleEvent(0xc4202f0000, 0xc420349a90, 0xc4201b7a88, 0x0)
/home/josh/go/src/github.com/MichaelMure/git-bug/vendor/github.com/MichaelMure/gocui/gui.go:413 +0x40
github.com/MichaelMure/git-bug/vendor/github.com/MichaelMure/gocui.(*Gui).MainLoop(0xc4202f0000, 0x0, 0x0)
/home/josh/go/src/github.com/MichaelMure/git-bug/vendor/github.com/MichaelMure/gocui/gui.go:373 +0x2cf
github.com/MichaelMure/git-bug/termui.initGui(0x0)
/home/josh/go/src/github.com/MichaelMure/git-bug/termui/termui.go:105 +0xdd
github.com/MichaelMure/git-bug/termui.Run(0xc4200b9d40, 0xc4202a0c70, 0xc4200b9d40)
/home/josh/go/src/github.com/MichaelMure/git-bug/termui/termui.go:61 +0x19a
github.com/MichaelMure/git-bug/commands.runTermUI(0xf26540, 0xf4e670, 0x0, 0x0, 0x0, 0x0)
/home/josh/go/src/github.com/MichaelMure/git-bug/commands/termui.go:18 +0xcf
github.com/MichaelMure/git-bug/vendor/github.com/spf13/cobra.(*Command).execute(0xf26540, 0xf4e670, 0x0, 0x0, 0xf26540, 0xf4e670)
/home/josh/go/src/github.com/MichaelMure/git-bug/vendor/github.com/spf13/cobra/command.go:826 +0x468
github.com/MichaelMure/git-bug/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xf23840, 0x405b7c, 0xc42009c058, 0x0)
/home/josh/go/src/github.com/MichaelMure/git-bug/vendor/github.com/spf13/cobra/command.go:914 +0x306
github.com/MichaelMure/git-bug/vendor/github.com/spf13/cobra.(*Command).Execute(0xf23840, 0x0, 0xc420028170)
/home/josh/go/src/github.com/MichaelMure/git-bug/vendor/github.com/spf13/cobra/command.go:864 +0x2b
github.com/MichaelMure/git-bug/commands.Execute()
/home/josh/go/src/github.com/MichaelMure/git-bug/commands/root.go:54 +0x2d
main.main()
/home/josh/go/src/github.com/MichaelMure/git-bug/git-bug.go:17 +0x20
goroutine 19 [syscall, 2 minutes]:
os/signal.signal_recv(0xc04580)
/usr/lib/go-1.10/src/runtime/sigqueue.go:139 +0xa6
os/signal.loop()
/usr/lib/go-1.10/src/os/signal/signal_unix.go:22 +0x22
created by os/signal.init.0
/usr/lib/go-1.10/src/os/signal/signal_unix.go:28 +0x41
goroutine 34 [select, 6 minutes, locked to thread]:
runtime.gopark(0xbb9560, 0x0, 0xb512f2, 0x6, 0x18, 0x1)
/usr/lib/go-1.10/src/runtime/proc.go:291 +0x11a
runtime.selectgo(0xc420051f50, 0xc4202b2060)
Showing /usr/lib/go-1.10/src/runtime/select.go:392 +0xe50
runtime.ensureSigM.func1()hjkl] Navigation [↵] Open bug [n] New bug [i] Pull [o] Push
/usr/lib/go-1.10/src/runtime/signal_unix.go:549 +0x1f4
runtime.goexit()
/usr/lib/go-1.10/src/runtime/asm_amd64.s:2361 +0x1
goroutine 23 [chan receive, 6 minutes]:
github.com/MichaelMure/git-bug/util/interrupt.RegisterCleaner.func2()
/home/josh/go/src/github.com/MichaelMure/git-bug/util/interrupt/cleaner.go:54 +0xf3
created by github.com/MichaelMure/git-bug/util/interrupt.RegisterCleaner
/home/josh/go/src/github.com/MichaelMure/git-bug/util/interrupt/cleaner.go:51 +0x20c
goroutine 26 [select]:
github.com/MichaelMure/git-bug/vendor/github.com/nsf/termbox-go.PollEvent(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/josh/go/src/github.com/MichaelMure/git-bug/vendor/github.com/nsf/termbox-go/api.go:331 +0x288
github.com/MichaelMure/git-bug/vendor/github.com/MichaelMure/gocui.(*Gui).MainLoop.func1(0xc4202f0000)
/home/josh/go/src/github.com/MichaelMure/git-bug/vendor/github.com/MichaelMure/gocui/gui.go:354 +0x30
created by github.com/MichaelMure/git-bug/vendor/github.com/MichaelMure/gocui.(*Gui).MainLoop
/home/josh/go/src/github.com/MichaelMure/git-bug/vendor/github.com/MichaelMure/gocui/gui.go:352 +0x6e
goroutine 116 [select]:
github.com/MichaelMure/git-bug/vendor/github.com/nsf/termbox-go.Init.func1()
/home/josh/go/src/github.com/MichaelMure/git-bug/vendor/github.com/nsf/termbox-go/api.go:87 +0x35c
created by github.com/MichaelMure/git-bug/vendor/github.com/nsf/termbox-go.Init
/home/josh/go/src/github.com/MichaelMure/git-bug/vendor/github.com/nsf/termbox-go/api.go:84 +0x57d
josh@cookie:~/Codes/cheshiresoft-bugs$
Edit: Oh, I just realized... this is using the unstable version which I installed this morning with go get (forgot that was on my path). If you think this might be a different behavior than v0.5.0 I can delete the unstable copy and go back to using v0.5.0.
I managed to trigger that bug as well, during a demo of all the possible timing ...
One possible way to explore is to ditch my fork of gocui and migrate to the maintained https://github.com/awesome-gocui/gocui
Another thing to explore is that gocui require that changes in the UI state to be made in sync with the main loop. For git-bug concern, that means in a layout function or through a g.Update(func(gui *gocui.Gui) error {. Maybe there is some place in the termui that doesn't respect this.