~sircmpwn/aerc2#285: 
panic: runtime error: index out of range in worker/imap/worker.go

When deleting a large chunk of emails, often times while working through the deletes, aerc will throw an index out of range error. I pinpointed the offending code to be in worker/imap/worker.go:228-229

i := update.SeqNum - 1
uid := w.seqMap[i]

For some reason the update.SeqNum is much larger than the seqMap length. In one example run, len(w.seqMap) == 7 and i == 23. I would patch myself, but I am not completely sure of the underlying issue and would rather avoid a hacky fix.

Status
REPORTED
Submitter
~devonrjohnson
Assigned to
No-one
Submitted
1 year, 1 month ago
Updated
a month ago
Labels
bug

~rleek 1 year, 1 month ago

I've been getting this error as well. It happens to me when the program is idle.

~devonrjohnson 1 year, 1 month ago

Do you know if it is the same section of code causing it? Or is it just another index out of range error? I have not been able to completely reliably reproduce the error, I just know it happens in that section of code when deleting chunks of emails from the *client.ExpungeUpdate case in the handleImapUpdate function.

~rleek 1 year, 1 month ago

It's the same line. 229 in workers/imap/worker.go

I do have a different client running on my office machine that deletes a bunch of junk emails for the same email box so maybe it's still related to deleting.

~devonrjohnson 1 year, 1 month ago

If it is the same line, I would expect that to be the case. But I am by no means an expert on the code. I just don't know why else the imap worker would need to expunge messages. Hopefully someone with a little more expertise can help debug.

~sbinet a month ago

hi there,

apologies for digging up that thread, but I do get these panics as well:

* 105 FETCH (FLAGS (\Seen))
2020/09/25 15:08:40 ->(ui) *types.MessagesDeleted
2020/09/25 15:08:40 (= *client.ExpungeUpdate
2020/09/25 15:08:40 (ui)<= *types.MessagesDeleted(595)
2020/09/25 15:08:40 (ui)<= *types.MessagesDeleted(596)
2020/09/25 15:08:40 (ui)<= *types.MessagesDeleted(597)
panic: runtime error: index out of range [107] with length 107

goroutine 52 [running]:
git.sr.ht/~sircmpwn/aerc/worker/imap.(*IMAPWorker).handleImapUpdate(0xc0000ae500, 0x55db328fe458, 0xc0003ec298)
	git.sr.ht/~sircmpwn/aerc/worker/imap/worker.go:236 +0x70a
git.sr.ht/~sircmpwn/aerc/worker/imap.(*IMAPWorker).Run(0xc0000ae500)
	git.sr.ht/~sircmpwn/aerc/worker/imap/worker.go:260 +0x10f
created by git.sr.ht/~sircmpwn/aerc/widgets.NewAccountView
	git.sr.ht/~sircmpwn/aerc/widgets/account.go:85 +0x518

(with 42ce6b4 as well)

any insights? (for me it's usually when aerc is idle, or when I don't look at it for a while, that usually happens)

cheers,

-s

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