I don't remember what triggers this bug.
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x60 pc=0x8b1397]
goroutine 1 [running]:
github.com/creack/pty.StartWithAttrs(0x0, 0xc000841a28, 0xc00032c500, 0xc000736318, 0x0, 0x0)
/home/ilyaigpetrov/go/pkg/mod/github.com/creack/pty@v1.1.10/run.go:57 +0xa7
git.sr.ht/~sircmpwn/aerc/widgets.(*Terminal).Draw(0xc000740fd0, 0xc00046d560)
/home/ilyaigpetrov/Soft/aerc/widgets/terminal.go:241 +0x89f
git.sr.ht/~sircmpwn/aerc/lib/ui.(*Grid).Draw(0xc000740f20, 0xc00046d230)
/home/ilyaigpetrov/Soft/aerc/lib/ui/grid.go:142 +0x255
git.sr.ht/~sircmpwn/aerc/widgets.(*Composer).Draw(0xc000524600, 0xc00046d230)
/home/ilyaigpetrov/Soft/aerc/widgets/compose.go:298 +0x48
git.sr.ht/~sircmpwn/aerc/lib/ui.(*TabContent).Draw(0xc0000dc690, 0xc00046d230)
/home/ilyaigpetrov/Soft/aerc/lib/ui/tab.go:393 +0x5f
git.sr.ht/~sircmpwn/aerc/lib/ui.(*Grid).Draw(0xc0000b80b0, 0xc000097d10)
/home/ilyaigpetrov/Soft/aerc/lib/ui/grid.go:142 +0x255
git.sr.ht/~sircmpwn/aerc/widgets.(*Aerc).Draw(0xc0000b8160, 0xc000097d10)
/home/ilyaigpetrov/Soft/aerc/widgets/aerc.go:172 +0x3d
git.sr.ht/~sircmpwn/aerc/lib/ui.(*UI).Tick(0xc0000e60a0, 0xc00009e400)
/home/ilyaigpetrov/Soft/aerc/lib/ui/ui.go:113 +0xf6
main.main()
/home/ilyaigpetrov/Soft/aerc/aerc.go:192 +0x672
aerc is of version 0.4.0
I encountered this error too, running latest f9bba3d1.
panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x60 pc=0x55dd28569c72] goroutine 1 [running]: github.com/creack/pty.StartWithAttrs(0x0, 0xc00001b8e8, 0xc0007aa280, 0xc0007c6000, 0x0, 0x0) github.com/creack/pty@v1.1.10/run.go:57 +0xb2 git.sr.ht/~sircmpwn/aerc/widgets.(*Terminal).Draw(0xc0004320b0, 0xc000412c90) git.sr.ht/~sircmpwn/aerc/widgets/terminal.go:241 +0x8de git.sr.ht/~sircmpwn/aerc/lib/ui.(*Grid).Draw(0xc0003676b0, 0xc0004129f0) git.sr.ht/~sircmpwn/aerc/lib/ui/grid.go:144 +0x277 git.sr.ht/~sircmpwn/aerc/widgets.(*Composer).Draw(0xc000998120, 0xc0004129f0) git.sr.ht/~sircmpwn/aerc/widgets/compose.go:309 +0x4a git.sr.ht/~sircmpwn/aerc/lib/ui.(*TabContent).Draw(0xc000264bd0, 0xc0004129f0) git.sr.ht/~sircmpwn/aerc/lib/ui/tab.go:394 +0x7c git.sr.ht/~sircmpwn/aerc/lib/ui.(*Grid).Draw(0xc0000be4d0, 0xc00011e180) git.sr.ht/~sircmpwn/aerc/lib/ui/grid.go:144 +0x277 git.sr.ht/~sircmpwn/aerc/widgets.(*Aerc).Draw(0xc0000be580, 0xc00011e180) git.sr.ht/~sircmpwn/aerc/widgets/aerc.go:176 +0x3f git.sr.ht/~sircmpwn/aerc/lib/ui.(*UI).Tick(0xc0003b0000, 0xc000120000) git.sr.ht/~sircmpwn/aerc/lib/ui/ui.go:113 +0x1d1 main.main() git.sr.ht/~sircmpwn/aerc/aerc.go:194 +0x697
I seems that
term.cmd
isnil
in this line:tty, err := pty.StartWithAttrs(term.cmd, &winsize, &syscall.SysProcAttr{Setsid: true, Setctty: true, Ctty: 1})
but that’s weird because with the test just before, the function should have exited before reaching this line.
Just hit the same panic when exiting the composer on 0.5.2. This is the first time that exiting a composer caused a panic, which may suggest a race somewhere.
Looks like
Terminal.Close
can be called concurrently withTerminal.Draw
.Terminal.Close
setsterm.cmd
to nil, so if it times just right, it'll cause a panic.The terminal widget probably needs to locking around the fields touched by
Close
.