Skip to content

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

@mattpr

Description

@mattpr

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or requestlow priorityWon't fix anytime soon, but will accept PR if provided

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions