~sircmpwn/aerc2#331
Panic when trying to open unread message

Whenever I try to open an unread message, aerc panics with the following output:

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

goroutine 92 [running]:
bufio.(*Scanner).Scan(0xc00026ef40, 0xc0002c4000)
    /usr/lib/go/src/bufio/scan.go:213 +0x75
git.sr.ht/~sircmpwn/aerc/widgets.(*PartViewer).attemptCopy.func4(0xc000562000, 0xc0002e2d60)
    /home/philipp/.cache/pikaur/build/aerc/src/aerc-0.3.0/widgets/msgviewer.go:591 +0x574
created by git.sr.ht/~sircmpwn/aerc/widgets.(*PartViewer).attemptCopy
    /home/philipp/.cache/pikaur/build/aerc/src/aerc-0.3.0/widgets/msgviewer.go:565 +0x144

Opening an already read message works without problems. I run aerc version 0.3.0 installed from the AUR.

Status
REPORTED
Submitter
~ferruck
Assigned to
No-one
Submitted
a month ago
Updated
a month ago
Labels
No labels applied.

~labrat a month ago

Which backend do you use and which email provider if it's IMAP?

Outlook's exchange server has various issues

~ferruck a month ago

Yes, it's IMAP and the provider is your-server.de (Hetzner), so no Outlook here.

~ferruck a month ago

I just confirmed that this issue is still present with current HEAD.

Since this is a real show-stopper for me, I just wanted to ask if there's anything I can do to help fixing this issue. Can I provide some more detailed logs (and if yes, how)?

~labrat a month ago

Well, if you can reproduce it locally it would be helpful to actually debug the code (and then fixing it ;) )

If you don't want to do that, you can get logs by redirecting stdout to a file aerc > aerc.log

Does this always happen or only sometimes?

~ferruck a month ago

Well, if you can reproduce it locally it would be helpful to actually debug the code (and then fixing it ;) )

I would, but I have only little time here at work for such hobby things. This is why input from more experienced aerc and Go developers is crucial to speed things up!

I had Go create a core dump and loaded that into GDB but didn't manage to load the symbols. All information I could find on the web were about debugging a single file application, but how do I load the symbols for a more complex Go application? Are these even present in the executable generated by the Makefile?

However, here's the log:

2019/12/16 13:04:17 Starting up aerc
2019/12/16 13:04:17 (ui)=> *types.Configure
2019/12/16 13:04:17 (ui)=> *types.Connect
2019/12/16 13:04:17 <-(ui) *types.Configure(2)
2019/12/16 13:04:17 <-(ui) *types.Connect(3)
2019/12/16 13:04:17 Starting Unix server
2019/12/16 13:04:17 Failed to start Unix server: listen unix /run/user/1000/aerc.sock: bind: address already in use (non-fatal)
Ba0diA SELECT INBOX
* FLAGS (\Draft \Answered \Flagged \Deleted \Seen \Recent)
* OK [PERMANENTFLAGS (\* \Draft \Answered \Flagged \Deleted \Seen)] Limited
* 1 EXISTS
* 0 RECENT
* OK [UIDVALIDITY 575274516] Ok
* OK [MYRIGHTS "acdilrsw"] ACL
Ba0diA OK [READ-WRITE] Ok
2019/12/16 13:04:17 ->(ui) *types.Done:*types.Connect
2019/12/16 13:04:17 (ui)<= *types.Done(4):*types.Connect(3)
2019/12/16 13:04:17 Listing mailboxes...
2019/12/16 13:04:17 (ui)=> *types.ListDirectories
2019/12/16 13:04:17 <-(ui) *types.ListDirectories(5)
2019/12/16 13:04:17 Listing mailboxes
Ld_HIw LIST "" "*"
* LIST (\HasNoChildren) "." "INBOX.Drafts"
* LIST (\Marked \HasChildren) "." "INBOX"
* LIST (\HasNoChildren) "." "INBOX.spambucket"
* LIST (\HasNoChildren) "." "INBOX.Templates"
* LIST (\HasNoChildren) "." "INBOX.Sent"
* LIST (\HasNoChildren) "." "INBOX.Trash"
Ld_HIw OK LIST completed
2019/12/16 13:04:17 ->(ui) *types.Directory:*types.ListDirectories
2019/12/16 13:04:17 ->(ui) *types.Directory:*types.ListDirectories
2019/12/16 13:04:17 ->(ui) *types.Directory:*types.ListDirectories
2019/12/16 13:04:17 ->(ui) *types.Directory:*types.ListDirectories
2019/12/16 13:04:17 ->(ui) *types.Directory:*types.ListDirectories
2019/12/16 13:04:17 ->(ui) *types.Directory:*types.ListDirectories
2019/12/16 13:04:17 ->(ui) *types.Done:*types.ListDirectories
2019/12/16 13:04:17 (ui)<= *types.Directory(6):*types.ListDirectories(5)
2019/12/16 13:04:17 (ui)<= *types.Directory(7):*types.ListDirectories(5)
2019/12/16 13:04:17 (ui)<= *types.Directory(8):*types.ListDirectories(5)
2019/12/16 13:04:17 (ui)<= *types.Directory(9):*types.ListDirectories(5)
2019/12/16 13:04:17 (ui)<= *types.Directory(10):*types.ListDirectories(5)
2019/12/16 13:04:17 (ui)<= *types.Directory(11):*types.ListDirectories(5)
2019/12/16 13:04:17 (ui)<= *types.Done(12):*types.ListDirectories(5)
2019/12/16 13:04:17 (ui)=> *types.OpenDirectory
2019/12/16 13:04:17 Connected.
2019/12/16 13:04:17 <-(ui) *types.OpenDirectory(13)
2019/12/16 13:04:17 Opening INBOX
2DKj3A SELECT INBOX
* FLAGS (\Draft \Answered \Flagged \Deleted \Seen \Recent)
* OK [PERMANENTFLAGS (\* \Draft \Answered \Flagged \Deleted \Seen)] Limited
* 1 EXISTS
* 0 RECENT
* OK [UIDVALIDITY 575274516] Ok
* OK [MYRIGHTS "acdilrsw"] ACL
2DKj3A OK [READ-WRITE] Ok
2019/12/16 13:04:17 ->(ui) *types.Done:*types.OpenDirectory
2019/12/16 13:04:17 (= *client.MailboxUpdate
2019/12/16 13:04:17 ->(ui) *types.DirectoryInfo
2019/12/16 13:04:17 (= *client.MailboxUpdate
2019/12/16 13:04:17 ->(ui) *types.DirectoryInfo
2019/12/16 13:04:17 (= *client.StatusUpdate
oFX8uA CAPABILITY
2019/12/16 13:04:17 (ui)<= *types.Done(14):*types.OpenDirectory(13)
2019/12/16 13:04:17 (ui)<= *types.DirectoryInfo(15)
2019/12/16 13:04:17 (ui)<= *types.DirectoryInfo(16)
2019/12/16 13:04:17 (ui)=> *types.FetchDirectoryContents
2019/12/16 13:04:17 <-(ui) *types.FetchDirectoryContents(17)
* CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE AUTH=PLAIN ACL ACL2=UNION
oFX8uA OK CAPABILITY completed
vnL6Dg IDLE
+ entering idle mode
DONE
vnL6Dg OK IDLE completed
2019/12/16 13:04:18 Fetching UID list
uJKVWg UID SEARCH CHARSET "UTF-8" 1:*
* SEARCH 73
uJKVWg OK SEARCH done.
2019/12/16 13:04:18 Found 1 UIDs
2019/12/16 13:04:18 ->(ui) *types.DirectoryContents:*types.FetchDirectoryContents
2019/12/16 13:04:18 ->(ui) *types.Done:*types.FetchDirectoryContents
dmFfBQ IDLE
2019/12/16 13:04:18 (ui)<= *types.DirectoryContents(18):*types.FetchDirectoryContents(17)
2019/12/16 13:04:18 (ui)<= *types.Done(19):*types.FetchDirectoryContents(17)
2019/12/16 13:04:18 (ui)=> *types.FetchMessageHeaders
2019/12/16 13:04:18 <-(ui) *types.FetchMessageHeaders(20)
+ entering idle mode
DONE
dmFfBQ OK IDLE completed
2019/12/16 13:04:18 Fetching message headers
J5eJdg UID FETCH 73 (BODYSTRUCTURE ENVELOPE INTERNALDATE FLAGS UID BODY.PEEK[HEADER])
* 1 FETCH (BODYSTRUCTURE ("text" "plain" NIL NIL NIL "quoted-printable" 19 1 NIL NIL NIL) ENVELOPE ("Mon, 16 Dec 2019 12:45:27 +0100" "This is a test" (("Philipp Trommler" NIL "philipp.trommler" "edex-ug.de")) (("Philipp Trommler" NIL "philipp.trommler" "edex-ug.de")) (("Philipp Trommler" NIL "philipp.trommler" "edex-ug.de")) (("Philipp Trommler" NIL "philipp.trommler" "edex-ug.de")) NIL NIL NIL "<BZ6TG6DGVGQI.KNBKT8JJWPE2@epsilon>") INTERNALDATE "16-Dec-2019 12:46:00 +0100" FLAGS () UID 73 BODY[HEADER] {1216}
Return-path: <philipp.trommler@edex-ug.de>
Envelope-to: philipp.trommler@edex-ug.de
Delivery-date: Mon, 16 Dec 2019 12:46:00 +0100
Received: from sslproxy02.your-server.de ([78.47.166.47])
    by www104.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256)
    (Exim 4.89_1)
    (envelope-from <philipp.trommler@edex-ug.de>)
    id 1igop6-0003vp-Kk
    for philipp.trommler@edex-ug.de; Mon, 16 Dec 2019 12:46:00 +0100
Received: from [2003:c2:772f:5d73:fd82:b29:976a:58c9] (helo=localhost)
    by sslproxy02.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256)
    (Exim 4.92)
    (envelope-from <philipp.trommler@edex-ug.de>)
    id 1igop6-000OiY-ES
    for philipp.trommler@edex-ug.de; Mon, 16 Dec 2019 12:46:00 +0100
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8
Date: Mon, 16 Dec 2019 12:45:27 +0100
From: "Philipp Trommler" <philipp.trommler@edex-ug.de>
To: "Philipp Trommler" <philipp.trommler@edex-ug.de>
Subject: This is a test
Message-Id: <BZ6TG6DGVGQI.KNBKT8JJWPE2@epsilon>
X-Authenticated-Sender: philipp.trommler@edex-ug.de
X-Virus-Scanned: Clear (ClamAV 0.101.4/25665/Mon Dec 16 10:52:23 2019)
Delivered-To: edexnu-philipp.trommler@edex-ug.de

)
J5eJdg OK FETCH completed.
2019/12/16 13:04:18 ->(ui) *types.MessageInfo:*types.FetchMessageHeaders
2019/12/16 13:04:18 ->(ui) *types.Done:*types.FetchMessageHeaders
ptlABQ IDLE
2019/12/16 13:04:18 (ui)<= *types.MessageInfo(21):*types.FetchMessageHeaders(20)
2019/12/16 13:04:18 (ui)<= *types.Done(22):*types.FetchMessageHeaders(20)
+ entering idle mode
2019/12/16 13:04:18 (ui)=> *types.FetchMessageBodyPart
2019/12/16 13:04:18 <-(ui) *types.FetchMessageBodyPart(23)
DONE
ptlABQ OK IDLE completed
2019/12/16 13:04:18 Fetching message part
FNOmVw UID FETCH 73 (FLAGS UID BODY[1])
* 1 FETCH (FLAGS () UID 73 BODY[1] {19}
This is a test...
)
* 1 FETCH (FLAGS (\Seen))
FNOmVw OK FETCH completed.
2019/12/16 13:04:19 ->(ui) *types.MessageBodyPart:*types.FetchMessageBodyPart
2019/12/16 13:04:19 ->(ui) *types.MessageInfo:*types.FetchMessageBodyPart
2019/12/16 13:04:19 ->(ui) *types.MessageBodyPart:*types.FetchMessageBodyPart
2019/12/16 13:04:19 ->(ui) *types.MessageInfo:*types.FetchMessageBodyPart
2019/12/16 13:04:19 ->(ui) *types.Done:*types.FetchMessageBodyPart
dIPadA IDLE
2019/12/16 13:04:19 (ui)<= *types.MessageBodyPart(24):*types.FetchMessageBodyPart(23)
2019/12/16 13:04:19 (ui)<= *types.MessageInfo(25):*types.FetchMessageBodyPart(23)
2019/12/16 13:04:19 (ui)<= *types.MessageBodyPart(26):*types.FetchMessageBodyPart(23)
2019/12/16 13:04:19 (ui)<= *types.MessageInfo(27):*types.FetchMessageBodyPart(23)
2019/12/16 13:04:19 (ui)<= *types.Done(28):*types.FetchMessageBodyPart(23)
+ entering idle mode

Does this always happen or only sometimes?

Always.

~labrat a month ago

On Mon, Dec 16, 2019 at 12:22:28PM -0000, ~ferruck wrote:

I had Go create a core dump and loaded that into GDB but didn't manage to load the symbols. All information I could find on the web were about debugging a single file application, but how do I load the symbols for a more complex Go application? Are these even present in the executable generated by the Makefile?

Most people either use printline statements in the code or if you want a debugger delve [1]. I wouldn't suggest gdb for go code

I can't reproduce your issue I'm afraid... unread messages load just fine for me

[1] https://github.com/go-delve/delve/blob/master/Documentation/cli/getting_started.md

~ferruck a month ago

I can't reproduce your issue I'm afraid... unread messages load just fine for me

For my private accounts this is true, too, so it's what I've expected. Your hint to delve is what I've needed, I'll have a look into the issue again once I'm able to find some time at work. Thanks!

~ferruck a month ago

From what I can see the problem is, that the part obtained in widgets/msgviewer.go:586 contains a nil in part.Body.br.rd which is de-referenced in bufio/bufio.go:100 while trying to scan through the contents in widgets/msgviewer.go:594. I searched through the Go sources in order to find a possible reason why this may become nil but gave up after the third stacked function called NextPart(). The full backtrace:

0  0x00000000004321b0 in runtime.fatalpanic
   at /usr/lib/go/src/runtime/panic.go:847
1  0x0000000000431c12 in runtime.gopanic
   at /usr/lib/go/src/runtime/panic.go:722
2  0x0000000000446c7c in runtime.panicmem
   at /usr/lib/go/src/runtime/panic.go:199
3  0x0000000000446c7c in runtime.sigpanic
   at /usr/lib/go/src/runtime/signal_unix.go:394
4  0x00000000005a2ea4 in bufio.(*Reader).fill
   at /usr/lib/go/src/bufio/bufio.go:100
5  0x00000000005a3c2d in bufio.(*Reader).ReadSlice
   at /usr/lib/go/src/bufio/bufio.go:359
6  0x00000000006821e6 in mime/quotedprintable.(*Reader).Read
   at /usr/lib/go/src/mime/quotedprintable/reader.go:87
7  0x00000000005a5814 in bufio.(*Scanner).Scan
   at /usr/lib/go/src/bufio/scan.go:213
8  0x000000000088f8df in git.sr.ht/~sircmpwn/aerc/widgets.(*PartViewer).attemptCopy.func4
   at ./widgets/msgviewer.go:600
9  0x000000000045f331 in runtime.goexit
   at /usr/lib/go/src/runtime/asm_amd64.s:1357

I guess there's someone with actual Go knowledge needed here.

~ferruck a month ago

Don't mind

8  0x000000000088f8df in git.sr.ht/~sircmpwn/aerc/widgets.(*PartViewer).attemptCopy.func4
   at ./widgets/msgviewer.go:600

It's actually said line 594, but I inserted some debugging code.

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