isacikgoz / gitbatch

manage your git repositories in one place
MIT License
1.54k stars 53 forks source link

gitbatch SIGSEGV from time to time #46

Closed bastelfreak closed 5 years ago

bastelfreak commented 5 years ago

Hi, I've got a big directory with around 120 modules in it. Every second to third start directly fails like this:

$ gitbatch 
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x87351d]

goroutine 1 [running]:
github.com/jroimartin/gocui.(*Gui).View(0xc0001462d0, 0xb28d2f, 0x4, 0xc000109b20, 0x4356d3, 0x42bd21)
    /home/bastelfreak/go/src/github.com/jroimartin/gocui/gui.go:187 +0x4d
github.com/jroimartin/gocui.(*Gui).SetView(0xc0001462d0, 0xb28d2f, 0x4, 0x0, 0x0, 0x73, 0x36, 0x48, 0x6, 0xc000109bb8)
    /home/bastelfreak/go/src/github.com/jroimartin/gocui/gui.go:138 +0x148
github.com/isacikgoz/gitbatch/pkg/gui.(*Gui).layout(0xc0001461b0, 0xc0001462d0, 0x38, 0xc000109ca0)
    /home/bastelfreak/go/src/github.com/isacikgoz/gitbatch/pkg/gui/gui.go:163 +0xb0
github.com/isacikgoz/gitbatch/pkg/gui.(*Gui).layout-fm(0xc0001462d0, 0x0, 0x0)
    /home/bastelfreak/go/src/github.com/isacikgoz/gitbatch/pkg/gui/gui.go:142 +0x34
github.com/jroimartin/gocui.ManagerFunc.Layout(0xc0001331b0, 0xc0001462d0, 0x0, 0xc000109d08)
    /home/bastelfreak/go/src/github.com/jroimartin/gocui/gui.go:329 +0x30
github.com/jroimartin/gocui.(*Gui).flush(0xc0001462d0, 0x1, 0xc0001462d0)
    /home/bastelfreak/go/src/github.com/jroimartin/gocui/gui.go:435 +0xce
github.com/jroimartin/gocui.(*Gui).MainLoop(0xc0001462d0, 0xc0001462d0, 0x0)
    /home/bastelfreak/go/src/github.com/jroimartin/gocui/gui.go:367 +0xbd
github.com/isacikgoz/gitbatch/pkg/gui.(*Gui).Run(0xc0001461b0, 0x0, 0x0)
    /home/bastelfreak/go/src/github.com/isacikgoz/gitbatch/pkg/gui/gui.go:152 +0x19b
main.main()
    /home/bastelfreak/go/src/github.com/isacikgoz/gitbatch/main.go:35 +0x157
$ gitbatch --version
gitbatch version 0.2.0

Let me know if you need any more debug information.

wedens commented 5 years ago

I gett this error on every start with ~20 repos.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x85eb8c]

goroutine 39 [running]:
github.com/isacikgoz/gitbatch/pkg/git.(*RepoEntity).loadComponents(0xc00038a200, 0x1, 0xc00038a200, 0x0)
        /Users/ibrahim/go/src/github.com/isacikgoz/gitbatch/pkg/git/repository.go:134 +0xfc
github.com/isacikgoz/gitbatch/pkg/git.InitializeRepo(0xc000029740, 0x21, 0xc00020a070, 0x0, 0x0)
        /Users/ibrahim/go/src/github.com/isacikgoz/gitbatch/pkg/git/repository.go:104 +0x7d
github.com/isacikgoz/gitbatch/pkg/git.LoadRepositoryEntities.func1(0xc00020a070, 0xc00020a080, 0xc000212020, 0xc000029740, 0x21)
        /Users/ibrahim/go/src/github.com/isacikgoz/gitbatch/pkg/git/util-load.go:27 +0x7d
created by github.com/isacikgoz/gitbatch/pkg/git.LoadRepositoryEntities
        /Users/ibrahim/go/src/github.com/isacikgoz/gitbatch/pkg/git/util-load.go:23 +0x158

version 0.2.0

isacikgoz commented 5 years ago

Hey, @bastelfreak thanks for submitting the issue. It is a known issue, and it is an undeterministic error. I will investigate this.

isacikgoz commented 5 years ago

I patched this with the PR #47 , can you please update the app and try again and let me see the result? @bastelfreak

I tested it with around ~150 repos and seemed fine. Still, it may vary on computer performance. But the problem is caused by in gui.go:

    g.SetManagerFunc(gui.layout)

is called after loading repositories, instead of that I moved this line before loading repositories. I hope this will resolve the issue, you can see the change on b7526002579436856e02173de4445e543aa77b33

bastelfreak commented 5 years ago

thanks! I cannot reproduce this anymore.