# Timeout writing message to local



## micski (Mar 20, 2016)

The FreeBSD 10.2 system log has repeated errors, that relates to Sendmail:

```
sm-mta[xxx]: xxx: SYSERR(root): timeout writing message to local
```
How can I find more information about the cause of this problem?


----------



## SirDice (Mar 21, 2016)

As this seems to be mail related, /var/log/maillog would be my first guess.


----------



## micski (Mar 22, 2016)

The mail log looks healthy, but has the exact same error message as the system log has. I suspect, that "timeout writing message to local" translates to "system is critically low on memory".


----------



## micski (Mar 22, 2016)

I opened the mail queue and took a closer look at one of those messages, that are related to the "timeout writing message to local". It seems, that the reason for the error message is, that a domain name within the spam message does not exist. If that is the case, the "timeout writing message to local" translates to "Spam message, with bogus domain name in it, is held in the mail queue". Can a spam message really cause Sendmail to fill mail and system logs with such errors - and keep it in the mail queue? Can it cause FreeBSD to crash? This system crashed several times, resulting in total outage, after these errors was written to logs.


----------



## trev (Jun 12, 2017)

Same deal with a FreeBSD mailing list post I received today. The maillog reports:

`[...]v5BMsG90017996: SYSERR(root): timeout writing message to local
[...]v5BMsG90017996: to=devnul, delay=01:29:41, xdelay=00:00:32, mailer=local, pri=633434, relay=local, dsn=4.4.2, stat=Deferred: Name server: local: host name lookup failure`

Checking the mqueue finds:

`V8
T1497221665
K1497227046
N7
P633434
I0/88/882841
Mhost map: lookup (protected-networks.net): deferred
Fbns
$_mx2.freebsd.org [8.8.178.116]
$rESMTPS
$smx2.freebsd.org`

So the problem is that sendmail cannot resolve protected-networks.net ... but what is the solution now that the mail is stuck in the message queue and sendmail won't deliver it locally (Cc: to the list) until the original recipient's (To: ) domain resolves?

In the past, I've simply hacked the /etc/hosts file, but this cannot be THE fix


----------



## Masachika ISHIZUKA (Oct 23, 2017)

I received SPAM mail yesterday and the same error occured.
The trouble is that mail delay notification will be sent to return-path with SPAM subject header.
When return-path is made a destination of SPAM, the source of SPAM becomes my server. I have to fix sendmail.cf, but I have no time.


----------



## trev (Oct 23, 2017)

The possible "proper" FIX I have now used is to edit /etc/mail/submit.mc and add:


```
# Line below fixes unresolvable domains encountered when delivering
# email locally (after having been accepted by smtp).
# C = Don't perform hostname canonification.
define(`confDIRECT_SUBMISSION_MODIFIERS', `C')dnl
# Otherwise error message:
#  SYSERR(root): timeout writing message to local
#  stat=Deferred: Name server: local: host name lookup failure
```


----------



## micski (Oct 25, 2017)

Thanks to Mazachika for explaining more about the cause of this problem and to Trev for posting a possible fix. What does the modifications to Sendmail exactly do? I have found, that deleting the files in the related mail queue has worked fine as a work-around. It is my experience, that only spam ends there. I will test this fix.


----------

