Since I deployed Maddy several months ago I noticed that after some time I would get no emails. Restarting Maddy solves the issues. As I have a backup server and this does not happen that frequent I have not investigated it further until today.
Since it happened this evening and I still had the logs handy I noticed that after the Maddy restart I would not see incoming emails BUT my email client did show several new emails that arrived during the night. So this makes me believe the hang only affects authenticated connections.
Describe the bug
Since I deployed Maddy several months ago I noticed that after some time I would get no emails. Restarting Maddy solves the issues. As I have a backup server and this does not happen that frequent I have not investigated it further until today.
Since it happened this evening and I still had the logs handy I noticed that after the Maddy restart I would not see incoming emails BUT my email client did show several new emails that arrived during the night. So this makes me believe the hang only affects authenticated connections.
As I use LDAP I looked at the LDAP source code in Maddy and I think there is a likely bug: if the getConn (https://github.com/foxcpp/maddy/blob/dbf14fa08373be46a171ffa73f82e91fbdf80adf/internal/auth/ldap/ldap.go#L181) times out connecting (or any other error) the mutex would not be released.
The fix could be add
Unlock
calls at one of the following places (I could do a PR):getConn
Steps to reproduce
Log files
NA
Configuration file
Attaching LDAP settings
Environment information