[Mimedefang] too few slaves *and* too many open files = __FD_SETSIZE woes

Steven Winikoff smw at alcor.concordia.ca
Wed Oct 29 10:18:42 EDT 2008

>> So why not just increase the file descriptor limit?
>> Because this is on Linux, so even if we do increase it beyond the
>> default value of 1024, we still run into the __FD_SETSIZE limit of
>> 1024 descriptors, and I haven't found a way to increase that.
>Yeah, this is annoying.  I can think of two possible workarounds:
>1) Compile libmilter to use poll() instead of select().  I believe you
>can do that by defining the SM_CONF_POLL macro when compiling libmilter.

I started doing that last night, actually, just before writing to the
mimedefang list.  It definitely needed to be done, but it wasn't enough
to solve the problem.

>The multiplexor itself will still use select(), but it's usually the milter
>process that runs out of file descriptors, not the multiplexor.

Not in our case.  It does often happen that the milter has more files
open, but the death symptom was

   Oct 29 03:35:38 bonnie mimedefang-multiplexor[25591]: Error in
       Event_HandleEvent: Bad file descriptor.  MULTIPLEXOR IS TERMINATING.

>2) Invoke "mimedefang" with the "-C" option; this makes it conserve file
>descriptors by closing and reopening files instead of keeping them open
>across milter calls.  This may help a bit, and doesn't require recompiling.

I haven't tried this one yet, but the main reason why not is that the
milter seems to be doing fine with an elevated value for ulimit -n; it's
quite likely that there's something going on that I don't understand, but
it really is the multiplexor which keeps dying on us.

>and a third "workaround" that avoids the problem:
>3) Run multiple scanning machines (either real or virtual) so you can
>scale horizontally and avoid the whole mess, rather than using one or a
>few massive machines.

The four we have are actually enough for our current traffic volue -- or
at least they would be, but I don't know how to balance the load equally
across all four.  That's something we're working on right now, so I hope
to find out soon, though.

     - Steven
Steven Winikoff                | "'Somebody, SOMEBODY
Concordia University           |  Has to, you see.'
Montreal, QC, Canada           |  Then she picked out two Somebodies.
smw at alcor.concordia.ca         |  Sally and me."
http://alcor.concordia.ca/~smw |                             - Dr. Seuss

More information about the MIMEDefang mailing list