I think I've found a bug in the clamav-milter that has been causing us
some trouble.  The symptoms of the problem are that once clamav-milter
has been running for awhile, we notice messages like this in our error
log:

        hit max-children limit (1021 >= 20): waiting for some to exit

The number of max-children waiting will slowly continue to increase
until eventually the milter process comes unloaded.  Obviously, once
these messages start to appear, new SMTP sessions created by Sendmail
are significantly delayed (by the 60 second sleep inserted into the
clamfi_envfrom processing below).

I spend some time examining the code, and I think I found the section of
code contributing to the problem.  Here's a snippet of code from
clamav-milter.c.  The trouble, I think is lines 861 - 864 in the
clamfi_envfrom() function.

The return code of pthread_cond_timedwait is not examined for zero,
which would indicate that a child process has ended.  Since the reaping
is never accounted for, the n_children is not correctly decremented.

857        if(use_syslog)
858             syslog(LOG_NOTICE,
859                     "hit max-children limit (%u >= %u): waiting for
some to exit",
860                     n_children, max_children);
861             do
862                     rc = pthread_cond_timedwait(&n_children_cond,
&n_children_mutex,
863                             &timeout);
864             while(rc != ETIMEDOUT);
865     }
866     n_children++;


I believe the following 2 lines should be added after line 863

                        if (rc == 0)
                                n_children--;

Could someone confirm this for me?

If this is not the case, could someone think of another reason when the
n_children could ever get larger than max_children to such a degree?

Thanks

---
Jim C.          | Carroll-Net, Inc.
201-488-4092    |
www.carroll.com | Application Service Provider


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Clamav-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/clamav-users

Reply via email to