~rjarry/aerc-devel

2 2

panic in vsplit

Maarten Aertsen <maarten@nlnetlabs.nl>
Details
Message ID
<D5H44YGSVSQO.LS7CJL3L540Y@nlnetlabs.nl>
DKIM signature
pass
Download raw message
hi list, Tim,

Caught another panic earlier today, though I have not been able to reproduce it yet.

I think it happened in the message list, with a vsplit open, while moving to the next message after ~10 mins of doing nothing. If I manage to reproduce it, I'll retry on master and let you know. Right now, this is about as much as I know :\.

--Maarten

################################################################################
                                  PANIC CAUGHT!
                        2024-11-08T13:56:43.802737+0100
################################################################################

aerc has encountered a critical error and has terminated. Please help us fix
this by sending this log and the steps to reproduce the crash to:
~rjarry/aerc-devel@lists.sr.ht

Thank you

Version: 0.18.2 +notmuch-5.6.0 (go1.22.5 arm64 darwin 2024-08-05)
Error: runtime error: invalid memory address or nil pointer dereference

goroutine 1 [running]:
runtime/debug.Stack()
	runtime/debug/stack.go:24 +0x64
git.sr.ht/~rjarry/aerc/lib/log.PanicHandler()
	git.sr.ht/~rjarry/aerc/lib/log/panic-logger.go:49 +0x510
panic({0x10510ad00?, 0x105615190?})
	runtime/panic.go:770 +0x124
os/exec.closeDescriptors(...)
	os/exec/exec.go:586
os/exec.(*Cmd).Wait(0x14000188780)
	os/exec/exec.go:925 +0x1f4
git.sr.ht/~rockorager/vaxis/widgets/term.(*Model).Close(0x1400224f208)
	git.sr.ht/~rockorager/vaxis@v0.10.3/widgets/term/term.go:540 +0xf0
git.sr.ht/~rjarry/aerc/app.(*Terminal).closeErr(0x14000de4e60, {0x0, 0x0})
	git.sr.ht/~rjarry/aerc/app/terminal.go:62 +0x7c
git.sr.ht/~rjarry/aerc/app.(*Terminal).Close(...)
	git.sr.ht/~rjarry/aerc/app/terminal.go:45
git.sr.ht/~rjarry/aerc/app.(*PartViewer).Cleanup(0x14001cdc000)
	git.sr.ht/~rjarry/aerc/app/msgviewer.go:813 +0x38
git.sr.ht/~rjarry/aerc/app.(*PartSwitcher).Cleanup(...)
	git.sr.ht/~rjarry/aerc/app/partswitcher.go:205
git.sr.ht/~rjarry/aerc/app.(*MessageViewer).Close(...)
	git.sr.ht/~rjarry/aerc/app/msgviewer.go:396
git.sr.ht/~rjarry/aerc/app.(*AccountView).updateSplitView.func1()
	git.sr.ht/~rjarry/aerc/app/account.go:620 +0x128
main.main()
	git.sr.ht/~rjarry/aerc/main.go:289 +0x7ec
Details
Message ID
<D5HC57V5VFFG.2XO5V9NXS8OP3@timculverhouse.com>
In-Reply-To
<D5H44YGSVSQO.LS7CJL3L540Y@nlnetlabs.nl> (view parent)
DKIM signature
pass
Download raw message
On Fri Nov 8, 2024 at 3:25 PM CST, Maarten Aertsen wrote:
> hi list, Tim,

Hey Maarten - Thanks for the report.

> ################################################################################
>                                   PANIC CAUGHT!
>                         2024-11-08T13:56:43.802737+0100
> ################################################################################
>
> aerc has encountered a critical error and has terminated. Please help us fix
> this by sending this log and the steps to reproduce the crash to:
> ~rjarry/aerc-devel@lists.sr.ht
>
> Thank you
>
> Version: 0.18.2 +notmuch-5.6.0 (go1.22.5 arm64 darwin 2024-08-05)
> Error: runtime error: invalid memory address or nil pointer dereference
>
> goroutine 1 [running]:
> runtime/debug.Stack()
> 	runtime/debug/stack.go:24 +0x64
> git.sr.ht/~rjarry/aerc/lib/log.PanicHandler()
> 	git.sr.ht/~rjarry/aerc/lib/log/panic-logger.go:49 +0x510
> panic({0x10510ad00?, 0x105615190?})
> 	runtime/panic.go:770 +0x124
> os/exec.closeDescriptors(...)
> 	os/exec/exec.go:586
> os/exec.(*Cmd).Wait(0x14000188780)
> 	os/exec/exec.go:925 +0x1f4
> git.sr.ht/~rockorager/vaxis/widgets/term.(*Model).Close(0x1400224f208)
> 	git.sr.ht/~rockorager/vaxis@v0.10.3/widgets/term/term.go:540 +0xf0


Relevant code from vaxis:
```go
func (vt *Model) Close() {
	vt.mu.Lock()
	defer vt.mu.Unlock()
	if vt.cmd != nil && vt.cmd.Process != nil {
		vt.cmd.Process.Kill()
		vt.cmd.Wait() // Line 540
	}
	vt.pty.Close()
}
```

This makes no sense why the Wait would panic but the Kill didn't.

Anyone with more go knowledge happen to know?

-- 
Tim
Details
Message ID
<D5HUSMLMI6CX.156SJZORWN1NU@ringo>
In-Reply-To
<D5HC57V5VFFG.2XO5V9NXS8OP3@timculverhouse.com> (view parent)
DKIM signature
pass
Download raw message
Tim Culverhouse, Nov 09, 2024 at 04:42:
> On Fri Nov 8, 2024 at 3:25 PM CST, Maarten Aertsen wrote:
>> hi list, Tim,
>
> Hey Maarten - Thanks for the report.
>
>> ################################################################################
>>                                   PANIC CAUGHT!
>>                         2024-11-08T13:56:43.802737+0100
>> ################################################################################
>>
>> aerc has encountered a critical error and has terminated. Please help us fix
>> this by sending this log and the steps to reproduce the crash to:
>> ~rjarry/aerc-devel@lists.sr.ht
>>
>> Thank you
>>
>> Version: 0.18.2 +notmuch-5.6.0 (go1.22.5 arm64 darwin 2024-08-05)
>> Error: runtime error: invalid memory address or nil pointer dereference
>>
>> goroutine 1 [running]:
>> runtime/debug.Stack()
>> 	runtime/debug/stack.go:24 +0x64
>> git.sr.ht/~rjarry/aerc/lib/log.PanicHandler()
>> 	git.sr.ht/~rjarry/aerc/lib/log/panic-logger.go:49 +0x510
>> panic({0x10510ad00?, 0x105615190?})
>> 	runtime/panic.go:770 +0x124
>> os/exec.closeDescriptors(...)
>> 	os/exec/exec.go:586
>> os/exec.(*Cmd).Wait(0x14000188780)
>> 	os/exec/exec.go:925 +0x1f4
>> git.sr.ht/~rockorager/vaxis/widgets/term.(*Model).Close(0x1400224f208)
>> 	git.sr.ht/~rockorager/vaxis@v0.10.3/widgets/term/term.go:540 +0xf0
>
>
> Relevant code from vaxis:
> ```go
> func (vt *Model) Close() {
> 	vt.mu.Lock()
> 	defer vt.mu.Unlock()
> 	if vt.cmd != nil && vt.cmd.Process != nil {
> 		vt.cmd.Process.Kill()
> 		vt.cmd.Wait() // Line 540
> 	}
> 	vt.pty.Close()
> }
> ```
>
> This makes no sense why the Wait would panic but the Kill didn't.
>
> Anyone with more go knowledge happen to know?

Wait() didn't panic. The panic happens in os/exec.closeDescriptors().

https://github.com/golang/go/blob/go1.22.5/src/os/exec/exec.go#L586

I would assume that iterating over a nil array should not be an issue 
but maybe it is on aarch64.

Either that, or the line is off by one and the nil memory access occurs 
on the next line which may indicate that the parentIOPipes field 
contains a nil value.

In any case, this looks like a bug in the go library.

I found this which may be relevant:

https://github.com/golang/go/issues/28461

Maaren, I would advise trying to update go to the latest version and 
recompile aerc with it.

Tim, in the meantime, do we have multiple goroutines calling Wait() on 
this process at the same time? Could aerc have a reference to this 
process object, making the mutex useless?
Reply to thread Export thread (mbox)