SEGFAULT in aerc/widgets.(*MessageList).Draw


I encountered this crash with aerc 0.3.0.r183.g61e9940. I don’t know how to reproduce it, I’ll add more information if I get this bug again.

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

goroutine 1 [running]:
git.sr.ht/~sircmpwn/aerc/widgets.(*MessageList).Draw(0xc000033440, 0xc0009084e0)
	git.sr.ht/~sircmpwn/aerc/widgets/msglist.go:112 +0x2cb
git.sr.ht/~sircmpwn/aerc/lib/ui.(*Grid).Draw(0xc000136580, 0xc0009081b0)
	git.sr.ht/~sircmpwn/aerc/lib/ui/grid.go:142 +0x257
git.sr.ht/~sircmpwn/aerc/widgets.(*AccountView).Draw(0xc000209a40, 0xc0009081b0)
	git.sr.ht/~sircmpwn/aerc/widgets/account.go:142 +0x3b
git.sr.ht/~sircmpwn/aerc/lib/ui.(*TabContent).Draw(0xc000209960, 0xc0009081b0)
	git.sr.ht/~sircmpwn/aerc/lib/ui/tab.go:393 +0x61
git.sr.ht/~sircmpwn/aerc/lib/ui.(*Grid).Draw(0xc000136420, 0xc00010abd0)
	git.sr.ht/~sircmpwn/aerc/lib/ui/grid.go:142 +0x257
git.sr.ht/~sircmpwn/aerc/widgets.(*Aerc).Draw(0xc0001364d0, 0xc00010abd0)
	git.sr.ht/~sircmpwn/aerc/widgets/aerc.go:172 +0x3f
git.sr.ht/~sircmpwn/aerc/lib/ui.(*UI).Tick(0xc00007e0f0, 0xc0001ee000)
	git.sr.ht/~sircmpwn/aerc/lib/ui/ui.go:113 +0xf8
	git.sr.ht/~sircmpwn/aerc/aerc.go:192 +0x674
Assigned to
7 months ago
2 months ago

~gdiazlo 7 months ago

I've been bitten by it too. I was changing accounts when it happened. It does not always happens though.

Sijmen Schoon 4 months ago · edit

(Hopefully I'm doing this correctly, this is my first time doing git related things via email)

I just got this issue too, on 0.4.0. After taking a quick gander at the source code, it seems to be because msg.Envelope is nil on the indicated line (on the current master HEAD (fe1cabb), that's line 108).

I feel this happens when (one of) the messages has not finished loading, but I'm having a hard time reproducing the issue. Perhaps expanding the nil check on line 98 will be enough?

widgets/msglist.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/widgets/msglist.go b/widgets/msglist.go index e38dd9e..c340770 100644 --- a/widgets/msglist.go +++ b/widgets/msglist.go @@ -95,7 +95,7 @@ func (ml *MessageList) Draw(ctx *ui.Context) { break }

  •           if msg == nil {
  •           if msg == nil || msg.Envelope == nil {
                      needsHeaders = append(needsHeaders, uid)
                      ml.spinner.Draw(ctx.Subcontext(0, row, textWidth, 1))
                      row += 1

~rucikir 2 months ago

I’ve ran into this issue once again; the trace I’m getting has changed and matches the previous message. I think it happened when one message hasn’t loaded or is being send, and I quit aerc (but I’m not sure).

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

goroutine 1 [running]:
git.sr.ht/~sircmpwn/aerc/widgets.(*MessageList).Draw(0xc000249da0, 0xc00080e6c0)
	git.sr.ht/~sircmpwn/aerc/widgets/msglist.go:108 +0x62d
git.sr.ht/~sircmpwn/aerc/lib/ui.(*Grid).Draw(0xc000154630, 0xc00080e630)
	git.sr.ht/~sircmpwn/aerc/lib/ui/grid.go:144 +0x277
git.sr.ht/~sircmpwn/aerc/widgets.(*AccountView).Draw(0xc000286bd0, 0xc00080e630)
	git.sr.ht/~sircmpwn/aerc/widgets/account.go:139 +0x3b
git.sr.ht/~sircmpwn/aerc/lib/ui.(*TabContent).Draw(0xc000286b60, 0xc00080e630)
	git.sr.ht/~sircmpwn/aerc/lib/ui/tab.go:394 +0x7c
git.sr.ht/~sircmpwn/aerc/lib/ui.(*Grid).Draw(0xc0001544d0, 0xc000226090)
	git.sr.ht/~sircmpwn/aerc/lib/ui/grid.go:144 +0x277
git.sr.ht/~sircmpwn/aerc/widgets.(*Aerc).Draw(0xc000154580, 0xc000226090)
	git.sr.ht/~sircmpwn/aerc/widgets/aerc.go:176 +0x3f
git.sr.ht/~sircmpwn/aerc/lib/ui.(*UI).Tick(0xc00026c820, 0xc0002c6000)
	git.sr.ht/~sircmpwn/aerc/lib/ui/ui.go:113 +0x1d1
	git.sr.ht/~sircmpwn/aerc/aerc.go:194 +0x697

it seems to be because msg.Envelope is nil on the indicated line


Indeed, that seems to be the case.

~y0ast 2 months ago

I hit this too and submitted the relevant patch: https://lists.sr.ht/~sircmpwn/aerc/patches/14540

I got it when quickly switching between two loading folders.

Register here or Log in to comment, or comment via email.