Skip to content

2050 Configured sendmail in dev / ci environments to return immediate…#2055

Open
osaerdna wants to merge 1 commit intodevfrom
2050-enhancement-creation-of-user-very-slow
Open

2050 Configured sendmail in dev / ci environments to return immediate…#2055
osaerdna wants to merge 1 commit intodevfrom
2050-enhancement-creation-of-user-very-slow

Conversation

@osaerdna
Copy link
Copy Markdown

@osaerdna osaerdna commented May 6, 2026

…ly instead of trying to send mail

I did notice that the user creation was somewhat slow in my dev environment, a profile of the request gave
...
800,815,612 (95.49%) 2,152 ( 0.09%) /var/www/html/src/inc/Util.php:Hashtopolis\inc\Util::sendMail
800,811,639 (95.49%) 880 ( 0.04%) php:internal:php::mail
21,322,474 ( 2.54%) 296 ( 0.01%) /var/www/html/src/inc/Encryption.php:Hashtopolis\inc\Encryption::passwordHash
21,319,117 ( 2.54%) 96 ( 0.00%) php:internal:php::password_hash
7,164,671 ( 0.85%) 402,800 (16.43%) /var/www/html/vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php:Slim\Middleware\RoutingMiddleware->performRouting
...
Which I interpret as lots of time is spent in php:internal:php::mail. Since I don't have any sendmail config in my environment I guess it tries with default config and traps waiting for something.

I guess that we don't see this in many production environments since most of them probably have mail configured correctly and then there is not much time taken for the send to complete.

About the fix, I took what I got from copilot, now we configure the environments (devcontainers and ci) to use /bin/true to simulate successful mail sending. I guess there are cases where we really would like the email to be sent and verified but that might be the exception and then will require some specific mail configuration to be done.

Profiling after the fix the send mail function is not noticed as significant enough to report (my guess) and the integration tests in test_user.py is faster to run, and my local setup of server / web-ui is runs with expected latency.

@osaerdna osaerdna requested a review from jessevz May 6, 2026 12:47
@jessevz
Copy link
Copy Markdown
Contributor

jessevz commented May 6, 2026

Very nice profiling to find out the bottleneck! But I do think it would be nice to check with logic wether mail is configured instead before sending an email. The thing is that it is not a requirement for a production setup to have mail configured, so then they will run into this bottleneck. Probably the easiest way would be to check the existence of the ssmtp.conf file. But if you can find another solution that would be good aswell

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants