maddy icon indicating copy to clipboard operation
maddy copied to clipboard

panic: Future.Set called multiple times

Open egorsmkv opened this issue 5 years ago • 5 comments

Describe the bug

I have got a panic during sending a message:

Sep 10 08:55:45 mailserver maddy[2079]: panic: Future.Set called multiple times
Sep 10 08:55:45 mailserver maddy[2079]: goroutine 4873 [running]:
Sep 10 08:55:45 mailserver maddy[2079]: github.com/foxcpp/maddy/framework/future.(*Future).Set(0xc000281900, 0x556b49201c00, 0xc0003ac640, 0x556b4933b500, 0xc0003ac620)
Sep 10 08:55:45 mailserver maddy[2079]:         github.com/foxcpp/maddy/framework/future/future.go:54 +0x10e
Sep 10 08:55:45 mailserver maddy[2079]: github.com/foxcpp/maddy/internal/target/remote.(*daneDelivery).PrepareConn.func1(0xc000300560, 0x556b4934d4e0, 0xc0003c6d20, 0xc0003f5460, 0x1b)
Sep 10 08:55:45 mailserver maddy[2079]:         github.com/foxcpp/maddy/internal/target/remote/security.go:400 +0x225
Sep 10 08:55:45 mailserver maddy[2079]: created by github.com/foxcpp/maddy/internal/target/remote.(*daneDelivery).PrepareConn
Sep 10 08:55:45 mailserver maddy[2079]:         github.com/foxcpp/maddy/internal/target/remote/security.go:397 +0xcd
Sep 10 08:55:45 mailserver systemd[1]: maddy.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Sep 10 08:55:45 mailserver systemd[1]: maddy.service: Failed with result 'exit-code'.

Steps to reproduce

  1. Just sent an email to two addresses on gmail.com and icloud.com

I tried to reproduce this issue but it seems it happened spontaneously.

Configuration file

It's the standard config file, except another domain name.

Environment information

  • maddy version: maddy 0.4.0+gf9d5c0c linux/amd64 go1.15.2

I've installed maddy from the source code.

egorsmkv avatar Sep 10 '20 11:09 egorsmkv

A link to the code line where the issue makes its panic: https://github.com/foxcpp/maddy/blob/master/internal/target/remote/security.go#L400

egorsmkv avatar Sep 10 '20 11:09 egorsmkv

For reference: Both gmail.com and icloud.com do not have any DANE records set.

foxcpp avatar Sep 19 '20 13:09 foxcpp

The error is still present. Do you need any further information @foxcpp ?

daniel-naegele avatar Oct 14 '20 09:10 daniel-naegele

I am unable to identify the root cause of the issue. Just stress testing sending mail to two domains with DANE checking enabled is not revealing anything.

I pushed c3987e3 to master that masks the issue by ignoring duplicated Future.Set calls.

foxcpp avatar Oct 17 '20 13:10 foxcpp

And added slightly more logging in 0000256 for it. This likely has some relation to resolver errors and this is why it is not always happening since most DNS errors are transient.

foxcpp avatar Oct 17 '20 13:10 foxcpp