Mailing List Archive

leakage of file descriptors in clamd
Hello!

There still exists leakage of file descriptors in clamd when thread is
canceled by timeout scanning some stream, especially from clamav-milter,
which opens connection to clamd after 'mail from' and closes it after end of
message. I still see those timeouts even with 2 hours timeout for clamd.

I see two ways to solve this, probably we need to implement both.
1. Close filedescriptors in clamd with pthread_cleanup_push().
2. Modify clamav-milter to save message in a temporary file and scan it by
clamd on EOM. This also makes it trivial to save a copy of all infected
files for future reference, which is already in TODO list.

I think all this should be made after new stable version is released.

misha.
Re: leakage of file descriptors in clamd [ In reply to ]
2003-11-04T16:30:30 Michael Dankov:
> There still exists leakage of file descriptors in clamd when
> thread is canceled [...]
>
> I see two ways to solve this, probably we need to implement both.

3. Pursue the nclamd that James Stevens just announced on this list.

Let's do all three. (or at least 1 and 3, I'm not a milter user
and so can't comment on that). Certainly fixing leaks is always
good. And so is making a friendlier invocation environment.

But I really think an architecture around pre-forked children, a
parent re-forker, and a counted limit of number of messages to
handle before exiting, is a good and robust way to deal with leaks,
crashes, etc. Unix's traditional process model works well for robust
servers. Threads are fragile.

Apache is written this way. I've written a very simple SMTP proxy in
perl that's written that way, and it's fast and robust. At least one
commercial antivirus product rewrote their Unix SMTP proxy to shift
from threads to pre-forked children, lost no performance to notice,
and improved their robustness in the face of new bugs.

-Bennett
Re: leakage of file descriptors in clamd [ In reply to ]
On Wed, 5 Nov 2003 00:30:30 +0300 (EET)
Michael Dankov <misha@btrc.ru> wrote:

> I see two ways to solve this, probably we need to implement both.
> 1. Close filedescriptors in clamd with pthread_cleanup_push().
> 2. Modify clamav-milter to save message in a temporary file and scan
> it by clamd on EOM. This also makes it trivial to save a copy of all
> infected files for future reference, which is already in TODO list.
>
> I think all this should be made after new stable version is
> released.

So do I. Fortunately this leak is not very critical.

Best regards,
Tomasz Kojm
--
oo ..... http://www.clamav.net/gpg/tkojm.gpg
(\/)\......... 0DCA5A08407D5288279DB43454822DC8985A444B
\..........._ Wed Nov 5 00:53:40 CET 2003
//\ /\