Set sensible SMTP timeout #475

Closed
opened 2026-02-04 21:04:14 +03:00 by OVERLORD · 4 comments
Owner

Originally created by @Kidswiss on GitHub (Nov 5, 2019).

When SMTP is enabled it will send a "new device" mail to the user's configured mail address. If that mail server is unreachable for some reason, or misconfigured, it will hang indefinitely with following log entries on the server:

[2019-10-27 17:43:33][rocket::rocket][INFO] POST /api/accounts/prelogin application/json; charset=utf-8:
[2019-10-27 17:43:33][_][INFO] Matched: POST /api/accounts/prelogin (prelogin)
[2019-10-27 17:43:33][_][INFO] Outcome: Success
[2019-10-27 17:43:33][_][INFO] Response succeeded.

On the client (Chrome):
image

Enabling debugging I saw that the server is hanging trying to connect to the SMTP host to send the "new device" mail, seemingly forever.

As discussed in #687 with @BlackDex there was already a discussion about this on the matrix chat on October 18.

Originally created by @Kidswiss on GitHub (Nov 5, 2019). When SMTP is enabled it will send a "new device" mail to the user's configured mail address. If that mail server is unreachable for some reason, or misconfigured, it will hang indefinitely with following log entries on the server: ``` [2019-10-27 17:43:33][rocket::rocket][INFO] POST /api/accounts/prelogin application/json; charset=utf-8: [2019-10-27 17:43:33][_][INFO] Matched: POST /api/accounts/prelogin (prelogin) [2019-10-27 17:43:33][_][INFO] Outcome: Success [2019-10-27 17:43:33][_][INFO] Response succeeded. ``` On the client (Chrome): ![image](https://user-images.githubusercontent.com/7460550/68217328-b40db600-ffe2-11e9-8f84-13ec4fc87437.png) Enabling debugging I saw that the server is hanging trying to connect to the SMTP host to send the "new device" mail, seemingly forever. As discussed in #687 with @BlackDex there was already a discussion about this on the matrix chat on October 18.
OVERLORD added the good first issue label 2026-02-04 21:04:14 +03:00
Author
Owner

@dani-garcia commented on GitHub (Nov 5, 2019):

I think by default the timeout is 60 seconds, but it makes sense to reduce it, and maybe allow it to be configurable too.

@dani-garcia commented on GitHub (Nov 5, 2019): I think by default the timeout is 60 seconds, but it makes sense to reduce it, and maybe allow it to be configurable too.
Author
Owner

@Kidswiss commented on GitHub (Nov 6, 2019):

You're right after some time it prints something about login success in the log (sorry currently at work can't get you the exact logs...).

But that may be too long as the client will never receive that information and gets stuck.

@Kidswiss commented on GitHub (Nov 6, 2019): You're right after some time it prints something about login success in the log (sorry currently at work can't get you the exact logs...). But that may be too long as the client will never receive that information and gets stuck.
Author
Owner

@dani-garcia commented on GitHub (Nov 9, 2019):

Resolved in #711, you can use SMTP_TIMEOUT=xx to set the timeout in seconds.

@dani-garcia commented on GitHub (Nov 9, 2019): Resolved in #711, you can use SMTP_TIMEOUT=xx to set the timeout in seconds.
Author
Owner

@Kidswiss commented on GitHub (Nov 9, 2019):

Awesome! Thanks for the quick fix!

@Kidswiss commented on GitHub (Nov 9, 2019): Awesome! Thanks for the quick fix!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/vaultwarden#475