[exim] write to main log fails after log cycling: Bad file d…

Top Page
Delete this message
Reply to this message
Author: Joe Gebis
Date:  
To: exim-users
Subject: [exim] write to main log fails after log cycling: Bad file descriptor
I have anacron set up to do daily tasks, including updating peerguardian
lists -- which generates a mail almost immediately, and generates a second
mail a few minutes later -- and cycling logs, including exim's logs.
Everything works great, except that about half the time, I get this in my
syslog:
Jul 8 07:38:54 hostname exim[6319]: 2016-07-08 07:38:54 <mailid> failed to
write to main log: length=92 result=-1 errno=9 (Bad file descriptor)
Jul 8 07:38:54 hostname exim[6319]: write failed on panic log: length=116
result=-1 errno=9 (Bad file descriptor)

I figured it had exim's logfile open, the logs got cycled, and the file
descriptor was bad. But...
1) I thought it should handle that gracefully
2) It only prints the error to syslog about half the time
3) Oddest thing: if I look in exim's main log, the first mail always works
fine (and goes to the new log file); the second email, which gets sent
about three minutes later, is the only one that has a problem.

When it has a problem, the mainlog looks like this:
2016-07-08 07:35:15 <mailid1> <= smarthostlogin@??? U=root P=local
S=55147
2016-07-08 07:35:15 <mailid1> => loginname <root@hostname> R=local_user
T=mail_spool
2016-07-08 07:35:15 <mailid1> Completed
2016-07-08 07:38:54 <mailid2> <= smarthostlogin@??? U=root P=local
S=1074
2016-07-08 07:46:46 Start queue run: pid=6394
2016-07-08 07:46:46 <mailid2> => loginname <root@hostname> R=local_user
T=mail_spool
2016-07-08 07:46:46 <mailid2> Completed

As you can see, the first mail after log cycling works. The second mail,
sent about three minutes later, doesn't complete immediately; but the next
time the queue runs, at 7:46, it does get sent. In fact, the second
message shows up in my mailbox twice.

It's not the worst problem in the world, but it would be nice if I could
figure out what's going on. I was previously using /usr/sbin/logrotate,
and then switched to using exicyclog to cycle exim's logs, but the problem
is exactly the same -- about half the time the above problem shows up (and
the other half, everything works just like it should, with no error
messages to syslog). Any ideas? Anything I can try? Thanks!