Mysql connection email mystery

I’ve got a script which will restart a bunch of services periodically, including mysql. It ran recently and I got the following mail.

Date: Tue, 27 Apr 2021 05:05:03 +0800
From: Mail Delivery System <[email protected]>
To: [email protected]
Subject: Mail failure - malformed recipient address

A message that you sent contained one or more recipient addresses that were
incorrectly constructed:

  < >: missing or malformed local part

This address has been ignored. There were no other addresses in your
message, and so no attempt at delivery was possible.

------ This is a copy of your message, including all the headers. ------

To: < >
Subject: =?utf-8?B?Cg==?=
From: Hestia Control Panel <[email protected]>
X-Priority: 3 (Normal)
CC:
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Mailer: Php/libMailv1.3
Message-Id: <[email protected]>
Date: Tue, 27 Apr 2021 05:05:03 +0800

Can't connect to MySQL localhost
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2)

So the fact that the message was sent is absolutely fine. I know Mysql was busy rebooting at this time, and I think Hestia might have been trying to do a backup or something.

But the email is sent with a blank To: field, and a nonsense Subject, which means it doesn’t get to where its meant to go, and bounces back to [email protected] I get other emails to the correct address, such as when Hestia updates itself, and the ‘notify me’ setting is set.

So I’m thinking there’s some legacy code somewhere which might not be picking up these settings, which should probably be fixed. I’ve found the send_email function, but that seems to be part of the web code (ie, used from the control panel). I’ve located a function in func/db.sh that looks likely, which seems to fire off when there is no connection.

Any ideas? Is this worth raising as a bug or will 1.4 fix everything! :slight_smile:

I think it’s worth raising a bug on github, as it is the second time I see this here.

first of all, I am quite certain this has nothing to do with mysql at all. the mails are send automatically by the system if a cronjob for whatever reason creates some output.
this makes me guess the header/subject gets messed up by some processing in exim4. maybe there is something wrong in the config.

questions:

  • did you do any manual changes/customizations to exim4 (like using an external relay service)?
  • which user do you use to run that cronjob?

edit: oh, and what version are you running on what system?

we will investigate.

Found the cause of the bug. And it has been killed for 1.4

2 Likes

Cool. Mystery solved!