New device registration awaits SMTP which results in bitwarden client timeouts. #83

Open
opened 2025-07-08 08:39:21 -04:00 by AtHeartEngineer · 0 comments

Originally created by @mattpr on 5/15/2025

Vaultwarden Support String

Everything is in the discussion

Vaultwarden Build Version

v1.33.2

Deployment method

Manually Extracted from Container Image

Custom deployment method

not relevant.

Reverse Proxy

nginx (not relevant)

Host/Server Operating System

Linux

Operating System Version

Ubuntu 22 (not relevant)

Clients

Android

Client Version

2025.4.0 (20100) and 2025.5.0 (debug/standard)

Steps To Reproduce

Discussion here (just see last message).

Issue is when a new device is logged into to vaultwarden server AND smtp is enabled... the code awaits the email to be sent (to check for SMTP error)...meanwhile blocking the HTTP response.

If SMTP is slow (it often is) this significantly delays the HTTP response. Client timeouts (android client empirical testing) are 10 seconds and they hang up resulting in unexpected errors for users when vaultwarden is slow (because of slow SMTP). This is also bad user experience because when they first use vaultwarden on a new device they experience very slow logins unless vaultwarden is using a very fast SMTP server.

The fix is that this email sending should be moved into an async function that is not awaited itself by the new device code (so we don't block http response) but if there is an SMTP error it can still be caught and logged within the new async function.

Expected Result

vaultwarden should not block new device http response waiting on sending SMTP notification.

Actual Result

vaultwarden blocks new device HTTP response until SMTP is complete which can take a long time with slow SMTP, leading to 18 second http responses which lead to bitwarden client timeouts (10 seconds) and unexpected errors...as well as slow first logins which makes users think vaultwarden is slow.

Logs

See the discussion for lots of logs.

Screenshots or Videos

No response

Additional Context

No response

*Originally created by @mattpr on 5/15/2025* ### Vaultwarden Support String Everything is in the [discussion](https://github.com/dani-garcia/vaultwarden/discussions/5852#discussioncomment-13142675) ### Vaultwarden Build Version v1.33.2 ### Deployment method Manually Extracted from Container Image ### Custom deployment method not relevant. ### Reverse Proxy nginx (not relevant) ### Host/Server Operating System Linux ### Operating System Version Ubuntu 22 (not relevant) ### Clients Android ### Client Version 2025.4.0 (20100) and 2025.5.0 (debug/standard) ### Steps To Reproduce Discussion [here](https://github.com/dani-garcia/vaultwarden/discussions/5852#discussioncomment-13142675) (just see last message). Issue is when a new device is logged into to vaultwarden server AND smtp is enabled... [the code](https://github.com/dani-garcia/vaultwarden/blob/ad8484a2d511d47880742634173d94c03cb2bbf4/src/api/identity.rs#L268) `awaits` the email to be sent (to check for SMTP error)...meanwhile blocking the HTTP response. If SMTP is slow (it often is) this significantly delays the HTTP response. Client timeouts (android client empirical testing) are 10 seconds and they hang up resulting in unexpected errors for users when vaultwarden is slow (because of slow SMTP). This is also bad user experience because when they first use vaultwarden on a new device they experience very slow logins unless vaultwarden is using a very fast SMTP server. The fix is that this email sending should be moved into an async function that is not awaited itself by the new device code (so we don't block http response) but if there is an SMTP error it can still be caught and logged within the new async function. ### Expected Result vaultwarden should not block new device http response waiting on sending SMTP notification. ### Actual Result vaultwarden blocks new device HTTP response until SMTP is complete which can take a long time with slow SMTP, leading to 18 second http responses which lead to bitwarden client timeouts (10 seconds) and unexpected errors...as well as slow first logins which makes users think vaultwarden is slow. ### Logs ```text See the discussion for lots of logs. ``` ### Screenshots or Videos _No response_ ### Additional Context _No response_
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/vaultwarden#83