axllent / mailpit

An email and SMTP testing tool with API for developers
https://mailpit.axllent.org
MIT License
5.38k stars 133 forks source link

While running in docker, the server sometimes hangs and the client times out #351

Closed adibsaad closed 3 weeks ago

adibsaad commented 1 month ago

I'm running it in docker like this

  mailpit:
    image: axllent/mailpit:v1.20.2
    container_name: mailpit
    volumes:
      - mailpit-data:/data
    ports:
      - 1025:1025
      - 8025:8025
    environment:
        MP_DATA_FILE: /data/mailpit.db
        MP_SMTP_AUTH_ACCEPT_ANY: 1
        MP_SMTP_AUTH_ALLOW_INSECURE: 1
        MP_VERBOSE: 1

and I noticed that sometimes, the server seems to hang and emails don't go through, and my app times out. After it times out I'll see this line in the mailpit log

mailpit  | time="2024/08/19 21:24:22" level=debug msg="[smtpd] response (192.168.228.1) 220 2392b9ce4ed7 Mailpit ESMTP Service ready"
axllent commented 1 month ago

HI @adibsaad. What it looks like to me is potentially an application (client) error - The client is connects via SMTP, Mailpit then responds with 220 2392b9ce4ed7 Mailpit ESMTP Service ready, and then the client does not do anything after that. I haven't encountered any issues with Mailpit hanging before, so this is new to me.

  1. What client is communicating with Mailpit here, is it the mailpit sendmail, or another sendmail client, or an application making a direct SMTP connection?
    1. Can you define "hanging" - does the Mailpit web UI not work, or do you mean the SMTP transaction appears to hang?
    2. Does the CPU spike during this "hanging", and if so, is it Mailpit or another application spiking the CPU at this time?
adibsaad commented 1 month ago
  1. It's a Rails app using SMTP
  2. Web UI works, SMTP transaction appears to hang.
  3. Not seeing any CPU spike

The client is connects via SMTP, Mailpit then responds with 220 2392b9ce4ed7 Mailpit ESMTP Service ready, and then the client does not do anything after that

Not quite. When I fire the email sending code, I see the app hang, then it throws a timeout error, then I see the 220 ... line in mailpit log output.

Also, I'm running mailpit on docker via orbstack on a macbook m3 max.

axllent commented 1 month ago

It sounds like either an issue in the rails application (unlikely), or the application containers are having temporary issues communicating between each other. I do not think this has anything to do with either Mailpit or the Mailpit docker image as that has been used 170 million times and this is the first report of this (a very core part of Mailpit).

In your case you're also using a fairly new stack that, while using docker under the hood, has its own unique networking implementation (and based on your issue, it appears to be network-related). I cannot give you any clues as to where the issue lies though, but I think that debugging on the client (rails app and container) would potentially reveal more. Sorry, I don't think I can help you at all here.

github-actions[bot] commented 4 weeks ago

This issue has been marked as stale because it has been open for 7 days with no activity.

github-actions[bot] commented 3 weeks ago

This issue was closed because there has been no activity since being marked as stale.