[Mimedefang] File descriptors and error handling

Josh Kelley joshkel at gmail.com
Fri Nov 3 16:46:20 EST 2006


While trying to track down a problem on my mail server, I found a
couple of questions/problems regarding MIMEDefang:

First, a problem with MIMEDefang's error handling:  I'm getting some
errors "Unknown command '...' in RESULTS file" and "RESULTS file did
not finish with 'F' line" in my syslogs.  It looks like MIMEDefang
deletes working directories after this error occurs, even if
KEEP_FAILED_DIRECTORIES is set.  MIMEDefang should probably keep the
working directory for "RESULTS file did not finish with 'F' line",
"Overlong line in RESULTS file", and possibly "Failure in cleanup" and
"Unknown command '%c' in RESULTS file."

Second, I'm apparently having problems with my file descriptors
getting mixed up in MIMEDefang.  Binary data of an unknown origin is
being written to RESULTS, nss_ldap's getpwnam lookups are trying to
read from a PTY that's opened for one of my mimedefang-filter's child
processes, and output intended for that child process is showing up in
syslog.  The problem seems very intermittent and only (or primarily)
seems to happen if nscd isn't running.

I'm wondering if some of the problem is caused by
mimedefang-multiplexor's closing all open file descriptors after
forking.  As part of its initialization on my system, it makes some
nss calls, which results in nss_ldap opening and leaving open an LDAP
connection; I'm guessing that nss_ldap is then running into trouble
(such as trying to read from a child's PTY or, perhaps, writing binary
data to RESULTS) after a fork because it's trying to use this
connection that it thought was still open.  I ran into similar
problems before with syslog trying to hold a file descriptor open
(fixed in MIMEDefang 2.42).  I'm starting to wonder if it would be
better if mimedefang-multiplexor not close file descriptors on a fork,
to avoid problems like this, since I don't see any good way for it to
know what FDs SpamAssassin, nss libraries, and so on have opened.

Any other ideas on how to track this problem down?

Thanks.

Josh Kelley



More information about the MIMEDefang mailing list