listmonk icon indicating copy to clipboard operation
listmonk copied to clipboard

SMTP timeout failure

Open krair opened this issue 10 months ago • 9 comments

Version:

  • listmonk: v3.0.0
  • OS: Podman via AlmaLinux 9

Description of the bug and steps to reproduce: I suppose the is related to the other thread(s) on SMTP failure. I am also getting the I/O timeout error as described in https://github.com/knadh/listmonk/issues/1492

I am using Mailjet as my smtp relay.

The initial setup (and test) of SMTP works just fine, the test email works great. However, subsequent emails (like a double opt-in) don't make it to the SMTP server and I get an error in the log:

2024/04/24 20:45:11 manager.go:513: error sending message 'Confirm subscription': dial tcp 104.199.96.85:465: i/o timeout

If I switch the port to 587 for example, the test email will go through fine, and subsequent messages will go through, but not for long. Switching back to port 465 will also work again for some time, but eventually I hit the same error.

krair avatar Apr 25 '24 08:04 krair

I should add that I use the exact same SMTP server, with the exact same SMTP settings, on the same server, in an app in a different container, and that works without failing after a period of time.

krair avatar Apr 25 '24 08:04 krair

hm, this seems related to https://github.com/knadh/listmonk/issues/1837 and similar issues in the past. The app's attempt to establish an outgoing TCP connection fails. This has to be in Docker/network/environment/firewall ... At his point, I'm at a loss ;(

knadh avatar Apr 25 '24 08:04 knadh

I don't know if this helps, but if I setup the smtp with the correct settings, the test email goes through.

Next, I click save settings, app reloads, I am still able to successfully send the test email (without leaving the page).

However, if I leave the page (go to dashboard for example) and return to the smtp settings, the test email fails with the i/o timeout error.

If I then change a setting like TLS from STARTTLS to TLS/SSL, and back to STARTTLS (never clicking save or anything else) the test email goes through just fine. There appears to be a bug in here, but I don't know go/js enough to start digging.

krair avatar Apr 25 '24 10:04 krair

When you change any setting and save, listmonk does a full restart. So something's getting flushed/cleared which is why it works. Then whatever's blocking the connection kicks in and connections fail. I'm at a loss here as to what could be blocking the connections and how.

knadh avatar Apr 25 '24 15:04 knadh

I think you misread what I said. When I change a setting BUT DON'T SAVE, it also works.

krair avatar Apr 25 '24 15:04 krair

That's just a coincidence. Changing the setting on the UI without hitting save has no effect on the backend. That's just a browser/UI thing.

knadh avatar Apr 25 '24 16:04 knadh

I tried to create a screen recording to show, and its true I can't get it to reliably reproduce the timeout error every time.

I will try running listmonk as a standalone binary and see if the error still exists.

Thank you anyways for the great app!

krair avatar Apr 25 '24 16:04 krair

If you're using docker it may be a firewall issue. See https://github.com/knadh/listmonk/issues/1837#issuecomment-2070181984.

Docker may be opening some ports after you make a change, and then your firewall blocks them again.

MaximilianKohler avatar Apr 25 '24 16:04 MaximilianKohler

@MaximilianKohler Thanks for the feedback, but firewalld with podman does not have the same outgoing restrictions. As stated above, the issue is intermittent. I will also try increasing the number of retries, and the timeout/wait times to see if it will clear up the issue.

krair avatar Apr 25 '24 17:04 krair

This issue has been marked 'stale' after 90 days of inactivity. If there is no further activity, it will be closed in 7 days.

github-actions[bot] avatar Jul 25 '24 01:07 github-actions[bot]