[tpop3d-discuss] possible memory leak with Perl authentication

Chris Lightfoot chris at ex-parrot.com
Sat, 8 Dec 2001 01:06:33 +0000

On Fri, Dec 07, 2001 at 05:40:14PM -0600, Christopher E. Stith wrote:
> I've recently installed tpop3d with a custom Perl authenticator
> for my virtual domain POP3 server. It works rather well, but I
> have a memory concern.
> When the process starts, it's around 2.3 megs. After four days, it
> was about 5.6 megs. It starts going up in 4k chunks every five to
> seven minutes at first, then it seems to slow down, but still grows.
> This is with just five hundred and ten or so boxes on the system, so
> if it depends upon accesses, I'd hate to see it when I move my other
> eleven to twelve thousand boxes to it from where they currenly sit.
> It has occurred to me that it could be due to Perl's habit of
> holding on to lexical memory for a scope in case the scope is
> re-entered and the fact that tpop3d uses an embedded compiler and
> bytecode interpeter for the language. I haven't sifted through the
> code enough to be sure, but it stands to reason looking at the
> system as a black box that Perl could be grabbing memory each
> authentication. I've tried undef()ing my lexicals when through with
> them.

I'm not going to pretend that tpop3d is guaranteed free of
memory leaks. Certainly some have existed in the past,
though all the ones I know about were fixed in a previous
release. I'm not aware of any auth-perl specific problems,
but I don't know how widely it is used. The tpop3d
installations I run don't use it.

Have you tried running your authenticator under auth-other
rather than auth-perl? If you used TPOP3D::AuthDriver,
then this conversion is easy to do. This has two
consequences: firstly, you will be able to tell whether
this is a perl or a tpop3d problem; secondly, if it is a
perl-related problem, you can very easily have your
authenticator quit every $n authentication requests, at
which point tpop3d will re-exec it.

    [ snip sensible comments ]

I think the first useful diagnostic to do is to try using

 ``Decommissioning is the perpetual rock
   upon which we have come adrift'' (Peter Mandelson)