Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] -Sending Test Email Results in Entire docker container freezing #4017

Closed
5 of 6 tasks
SpawnInsane opened this issue Aug 11, 2024 · 5 comments · Fixed by #4437
Closed
5 of 6 tasks

[BUG] -Sending Test Email Results in Entire docker container freezing #4017

SpawnInsane opened this issue Aug 11, 2024 · 5 comments · Fixed by #4437
Labels
bug Something isn't working triage

Comments

@SpawnInsane
Copy link

SpawnInsane commented Aug 11, 2024

First Check

  • This is not a feature request.
  • I added a very descriptive title to this issue (title field is above this).
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the Mealie documentation, with the integrated search.
  • I already read the docs and didn't find an answer.
  • This issue can be replicated on the demo site (https://demo.mealie.io/).

What is the issue you are experiencing?

When sending a test email from the settings menu, test will fail after a few minutes. When trying to access mealie after test fails, results in unresponsive webpage when you try to refresh the page it will not refresh. when you try to access the URL again it will not load.

Have to restart docker container in order to use mealie again.
Logs don't show anything since entire docker container freezes.

Steps to Reproduce

  1. Enter email address and send test email.
  2. Wait
  3. Test Fails and mealie becomes unresponsive

Please provide relevant logs

mealie.log

Mealie Version

Build Tag: c4a339ed36ad74cd4e6c7e22afc9c89c9dd4d8a2

Deployment

Unraid

Additional Deployment Details

No response

@SpawnInsane SpawnInsane added bug Something isn't working triage labels Aug 11, 2024
@mechanarchy
Copy link

I'm experiencing the same, exactly as described above. I have previously not had email configured, so can't provide any indication of when this may have broken. I am still on v1.9.0 but SpawnInsane is on v1.12.0 so it's not a recent regression.

Details
Version: v1.9.0
Build: d96c363
Application Mode: Production
Demo Status: Not Demo
API Port: 9000
API Docs: Enabled
Database Type: sqlite
Recipe Scraper Version: 14.56.0

Checks
Secure Site: Yes
Server Side Base URL: Yes
LDAP Ready: No
OIDC Ready: Yes
OpenAI Ready: No
Email Configured: Yes

@mechanarchy
Copy link

Minimum reproducible example:

# Enter the container
docker exec -it mealie /bin/bash

# Open a Python REPL
cd /app/mealie
python3

# Run the following Python:
import smtplib
from mealie.core.config import get_app_settings
settings = get_app_settings()
server = smtplib.SMTP(settings.SMTP_HOST, settings.SMTP_PORT, timeout=3)

Result:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/smtplib.py", line 398, in getreply
    line = self.file.readline(_MAXLINE + 1)
  File "/usr/local/lib/python3.10/socket.py", line 705, in readinto
    return self._sock.recv_into(b)
TimeoutError: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.10/smtplib.py", line 255, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/local/lib/python3.10/smtplib.py", line 343, in connect
    (code, msg) = self.getreply()
  File "/usr/local/lib/python3.10/smtplib.py", line 401, in getreply
    raise SMTPServerDisconnected("Connection unexpectedly closed: "
smtplib.SMTPServerDisconnected: Connection unexpectedly closed: timed out

Here, obviously, it times out because I have specifically set timeout=3. But in the Mealie code, there is no timeout, so it blocks the thread indefinitely with no logging (hence the necessity to restart the container to resume service):

with smtplib.SMTP(smtp.host, smtp.port) as server:
if smtp.tls:
server.starttls()

In my case, I am using this email configuration:

 'SMTP_AUTH_STRATEGY': 'TLS',
 'SMTP_FROM_EMAIL': 'redacted',
 'SMTP_FROM_NAME': 'Mealie',
 'SMTP_HOST': 'smtp.mailgun.org',
 'SMTP_PASSWORD': 'redacted',
 'SMTP_PORT': '465',
 'SMTP_USER': 'redacted',

@mechanarchy
Copy link

I just changed my port to 587 and it works now. I'm not sure what the root cause is but since I've achieved relief I don't really care. @SpawnInsane check your mail provider settings and see if an alternate port helps.

@SpawnInsane
Copy link
Author

Realized I made a pretty stupid mistake when I initially configured all the settings for email.
In the SMTP_HOST field I put smtp.google.com instead of the correct address smtp.gmail.com
Emails now working.

@flisk
Copy link

flisk commented Oct 15, 2024

Just stumbled over this issue because I ran into the same freezing behavior while setting up SMTP on my Mealie container. @SpawnInsane, would you mind re-opening it? I don't think it's sane behavior for Mealie to freeze completely while trying to send mail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants