[tpop3d-discuss] Memory leak?

Chris Lightfoot chris at ex-parrot.com
Wed, 8 May 2002 11:40:56 +0100


On Wed, May 08, 2002 at 01:19:58AM -0700, Marc Lewis wrote:
> On Wed, May 08, 2002 at 09:02:47AM +0100, Chris Lightfoot wrote:
> > On Tue, May 07, 2002 at 03:46:27PM -0700, Marc Lewis wrote:
> > > 
> > > We've been running tpop3d for about a week now, and find it to be
> > > excellent piece of software.
> > > 
> > > It has crashed on us twice, though, and I believe it may be because of a
> > > memory leak.
    [...]
> > > Suggestions/comments?
> > 
> > Can you tell me more about the configuration-- what
> > settings do you have in the config file? How is PAM
> > configured? 
> 
> Very straightforward:
> 
> listen-address: 0.0.0.0:110
> 
> max-children: 200
> strip-domain: yes
> mailbox: maildir:$(home)/Maildir
> auth-pam-enable: yes
> auth-pam-facility: tpop3d
> 
> timeout-seconds: 600

OK, this is fine....

> The contents of /etc/pam.d/tpop3d:
> 
> auth       required     pam_nologin.so
> auth       required     pam_stack.so service=system-auth
> account    required     pam_stack.so service=system-auth
> session    required     pam_stack.so service=system-auth
> 
> 
> The PAM/LDAP part is a bit trickier, but not by much.  It is the basic
> stuff from www.padl.com for authentication with 'ldap' added into
> /etc/nsswitch.conf for passwd, shadow and group.  It should be completely
> transparent to tpop3d as it is to Courier (the IMAP server we are using)
> and to SASL (for SMTP authentication with Postfix).

OK.

> > The fact that the parent process is growing in size
> > suggests a leak in the authentication code. I can't
> > reproduce what you're seeing here, but I don't have any of
> > the PAM LDAP stuff. I don't think that there's a problem
> > with the mmap code.
> > 
> > What does the output of cat /proc/<tpop3d PID>/maps
> > indicate?
> 
> Before restarting it:
> 
> # cat /proc/31761/maps
    [...]
> After restarting it:
    [...]
> # cat /proc/18301/maps
    [...]

These are both essentially the same, which is what I
expect.

> Let me know if there is any other information that you would like.

I've attached a trivial test of the PAM code, pamtest.c.
Could you replace `user' and `password' at the end with a
valid username and password, compile it with
    cc -o pamtest -lpam -ldl pamtest.c
and see whether it leaks memory when you run it?

Also, can you tell me more about the crashes you've
experienced -- in particular, is there any useful
information in the logs?

-- 
``We've heard that a million monkeys at a million typewriters could produce
  the complete works of Shakespeare. Now, thanks to the Internet, we know
  this is not true.'' (Robert Wilensky)