[tpop3d-discuss] Memory leak?

Marc Lewis marc at blarg.net
Wed, 8 May 2002 01:19:58 -0700


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.
> > 
> > # ps auxw | grep tpop3d
> > root     26088  4.3 46.1 476564 474164 ?     S    May06  55:45 tpop3d
>     [...]
> > The setup is for Maildir format.
> > 
> > I understand that tpop3d makes heavy use of mmap, but it doesn't seem to be
> > munmaping them correctly in Maildir mode, and the parent process keeps
> > growing as well, which has me concerned.
> > 
> > For completeness: The Maildir's are all over NFS, the systems are RedHat
> > 7.2 with all of the updates from RH applied, the MTA is Postfix 1.1.7, and
> > the local delivery agent is procmail 3.21.  Authentication is done via PAM
> > with the nss_ldap module, the mail servers run their own slaved LDAP
> > databases using OpenLDAP 2.0.21.
> > 
> > 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


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).

> 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:

# ps auxwf | grep tpop3d
root     31761  2.7 21.6 224812 222416 ?     S    May07  16:10 tpop3d

# cat /proc/31761/maps
08048000-08054000 r-xp 00000000 08:02 293235     /usr/local/sbin/tpop3d
08054000-08056000 rw-p 0000b000 08:02 293235     /usr/local/sbin/tpop3d
08056000-157cf000 rwxp 00000000 00:00 0
40000000-40016000 r-xp 00000000 08:03 73130      /lib/ld-2.2.4.so
40016000-40017000 rw-p 00015000 08:03 73130      /lib/ld-2.2.4.so
40017000-40018000 rw-p 00000000 00:00 0
40018000-4001a000 r-xp 00000000 08:02 112695     /usr/lib/sasl/libanonymous.so.1.0.15
4001a000-4001b000 rw-p 00001000 08:02 112695     /usr/lib/sasl/libanonymous.so.1.0.15
4001b000-4001d000 r-xp 00000000 08:02 112721     /usr/lib/sasl/liblogin.so.0.0.5
4001d000-4001e000 rw-p 00001000 08:02 112721     /usr/lib/sasl/liblogin.so.0.0.5
4001e000-40025000 r-xp 00000000 08:03 73264      /lib/libpam.so.0.75
40025000-40026000 rw-p 00006000 08:03 73264      /lib/libpam.so.0.75
40026000-40029000 r-xp 00000000 08:03 73143      /lib/libdl-2.2.4.so
40029000-4002a000 rw-p 00002000 08:03 73143      /lib/libdl-2.2.4.so
4002a000-4015c000 r-xp 00000000 08:03 73222      /lib/i686/libc-2.2.4.so
4015c000-40162000 rw-p 00131000 08:03 73222      /lib/i686/libc-2.2.4.so
40162000-40166000 rw-p 00000000 00:00 0
40166000-40170000 r-xp 00000000 08:03 73164      /lib/libnss_files-2.2.4.so
40170000-40171000 rw-p 00009000 08:03 73164      /lib/libnss_files-2.2.4.so
40171000-4017b000 r-xp 00000000 08:03 73172      /lib/libnss_nisplus-2.2.4.so
4017b000-4017c000 rw-p 00009000 08:03 73172      /lib/libnss_nisplus-2.2.4.so
4017c000-4018f000 r-xp 00000000 08:03 73148      /lib/libnsl-2.2.4.so
4018f000-40190000 rw-p 00012000 08:03 73148      /lib/libnsl-2.2.4.so
40190000-40192000 rw-p 00000000 00:00 0
40192000-40195000 r-xp 00000000 08:03 73161      /lib/libnss_dns-2.2.4.so
40195000-40196000 rw-p 00002000 08:03 73161      /lib/libnss_dns-2.2.4.so
40196000-401a4000 r-xp 00000000 08:03 73177      /lib/libresolv-2.2.4.so
401a4000-401a6000 rw-p 0000d000 08:03 73177      /lib/libresolv-2.2.4.so
401a6000-401a8000 rw-p 00000000 00:00 0
401a8000-401ee000 r-xp 00000000 08:03 74108      /lib/libnss_ldap-2.2.4.so
401ee000-401f1000 rw-p 00045000 08:03 74108      /lib/libnss_ldap-2.2.4.so
401f1000-401fe000 rw-p 00000000 00:00 0
401fe000-402a3000 r-xp 00000000 08:03 73186      /lib/libdb-3.2.so
402a3000-402a5000 rw-p 000a4000 08:03 73186      /lib/libdb-3.2.so
402a5000-402cf000 r-xp 00000000 08:03 73206      /lib/libssl.so.0.9.6b
402cf000-402d2000 rw-p 00029000 08:03 73206      /lib/libssl.so.0.9.6b
402d2000-40386000 r-xp 00000000 08:03 73205      /lib/libcrypto.so.0.9.6b
40386000-40392000 rw-p 000b3000 08:03 73205      /lib/libcrypto.so.0.9.6b
40392000-40395000 rw-p 00000000 00:00 0
40395000-40398000 r-xp 00000000 08:02 112715     /usr/lib/sasl/libcrammd5.so.1.0.15
40398000-40399000 rw-p 00002000 08:02 112715     /usr/lib/sasl/libcrammd5.so.1.0.15
40399000-403a0000 r-xp 00000000 08:02 112718     /usr/lib/sasl/libdigestmd5.so.0.0.17
403a0000-403a1000 rw-p 00006000 08:02 112718     /usr/lib/sasl/libdigestmd5.so.0.0.17
403a1000-403a3000 r-xp 00000000 08:02 112724     /usr/lib/sasl/libplain.so.1.0.14
403a3000-403a4000 rw-p 00001000 08:02 112724     /usr/lib/sasl/libplain.so.1.0.14
403a7000-403ac000 r-xp 00000000 08:03 73141      /lib/libcrypt-2.2.4.so
403ac000-403ad000 rw-p 00004000 08:03 73141      /lib/libcrypt-2.2.4.so
403ad000-403d4000 rw-p 00000000 00:00 0
403d8000-403d9000 r-xp 00000000 08:03 102716     /lib/security/pam_deny.so
403d9000-403da000 rw-p 00000000 08:03 102716     /lib/security/pam_deny.so
403da000-403dd000 r-xp 00000000 08:03 102717     /lib/security/pam_env.so
403dd000-403de000 rw-p 00002000 08:03 102717     /lib/security/pam_env.so
403de000-403e8000 r-xp 00000000 08:03 102588     /lib/security/pam_unix.so
403e8000-403ea000 rw-p 00009000 08:03 102588     /lib/security/pam_unix.so
403ea000-403f6000 rw-p 00000000 00:00 0
403f6000-403f9000 r-xp 00000000 08:03 102715     /lib/security/pam_cracklib.so
403f9000-403fa000 rw-p 00002000 08:03 102715     /lib/security/pam_cracklib.so
403fa000-403fe000 rw-p 00000000 00:00 0
403fe000-40401000 r-xp 00000000 08:03 102571     /lib/security/pam_limits.so
40401000-40402000 rw-p 00002000 08:03 102571     /lib/security/pam_limits.so
40404000-4040a000 r-xp 00000000 08:02 64334      /usr/lib/libcrack.so.2.7
4040a000-4040c000 rw-p 00005000 08:02 64334      /usr/lib/libcrack.so.2.7
4040c000-4040f000 rw-p 00000000 00:00 0
bfff9000-c0000000 rwxp ffffa000 00:00 0

After restarting it:

# ps auxwf | grep tpop
root     18301  0.9  0.3  6216 3812 ?        S    01:09   0:04 tpop3d

# cat /proc/18301/maps
08048000-08054000 r-xp 00000000 08:02 293235     /usr/local/sbin/tpop3d
08054000-08056000 rw-p 0000b000 08:02 293235     /usr/local/sbin/tpop3d
08056000-0829d000 rwxp 00000000 00:00 0
40000000-40016000 r-xp 00000000 08:03 73130      /lib/ld-2.2.4.so
40016000-40017000 rw-p 00015000 08:03 73130      /lib/ld-2.2.4.so
40017000-40018000 rw-p 00000000 00:00 0
40018000-4001a000 r-xp 00000000 08:02 112695     /usr/lib/sasl/libanonymous.so.1.0.15
4001a000-4001b000 rw-p 00001000 08:02 112695     /usr/lib/sasl/libanonymous.so.1.0.15
4001b000-4001d000 r-xp 00000000 08:02 112721     /usr/lib/sasl/liblogin.so.0.0.5
4001d000-4001e000 rw-p 00001000 08:02 112721     /usr/lib/sasl/liblogin.so.0.0.5
4001e000-40025000 r-xp 00000000 08:03 73264      /lib/libpam.so.0.75
40025000-40026000 rw-p 00006000 08:03 73264      /lib/libpam.so.0.75
40026000-40029000 r-xp 00000000 08:03 73143      /lib/libdl-2.2.4.so
40029000-4002a000 rw-p 00002000 08:03 73143      /lib/libdl-2.2.4.so
4002a000-4015c000 r-xp 00000000 08:03 73222      /lib/i686/libc-2.2.4.so
4015c000-40162000 rw-p 00131000 08:03 73222      /lib/i686/libc-2.2.4.so
40162000-40166000 rw-p 00000000 00:00 0
40166000-40170000 r-xp 00000000 08:03 73164      /lib/libnss_files-2.2.4.so
40170000-40171000 rw-p 00009000 08:03 73164      /lib/libnss_files-2.2.4.so
40171000-4017b000 r-xp 00000000 08:03 73172      /lib/libnss_nisplus-2.2.4.so
4017b000-4017c000 rw-p 00009000 08:03 73172      /lib/libnss_nisplus-2.2.4.so
4017c000-4018f000 r-xp 00000000 08:03 73148      /lib/libnsl-2.2.4.so
4018f000-40190000 rw-p 00012000 08:03 73148      /lib/libnsl-2.2.4.so
40190000-40192000 rw-p 00000000 00:00 0
40192000-40195000 r-xp 00000000 08:03 73161      /lib/libnss_dns-2.2.4.so
40195000-40196000 rw-p 00002000 08:03 73161      /lib/libnss_dns-2.2.4.so
40196000-401a4000 r-xp 00000000 08:03 73177      /lib/libresolv-2.2.4.so
401a4000-401a6000 rw-p 0000d000 08:03 73177      /lib/libresolv-2.2.4.so
401a6000-401a8000 rw-p 00000000 00:00 0
401a8000-401ee000 r-xp 00000000 08:03 74108      /lib/libnss_ldap-2.2.4.so
401ee000-401f1000 rw-p 00045000 08:03 74108      /lib/libnss_ldap-2.2.4.so
401f1000-401fe000 rw-p 00000000 00:00 0
401fe000-402a3000 r-xp 00000000 08:03 73186      /lib/libdb-3.2.so
402a3000-402a5000 rw-p 000a4000 08:03 73186      /lib/libdb-3.2.so
402a5000-402cf000 r-xp 00000000 08:03 73206      /lib/libssl.so.0.9.6b
402cf000-402d2000 rw-p 00029000 08:03 73206      /lib/libssl.so.0.9.6b
402d2000-40386000 r-xp 00000000 08:03 73205      /lib/libcrypto.so.0.9.6b
40386000-40392000 rw-p 000b3000 08:03 73205      /lib/libcrypto.so.0.9.6b
40392000-40395000 rw-p 00000000 00:00 0
40395000-40398000 r-xp 00000000 08:02 112715     /usr/lib/sasl/libcrammd5.so.1.0.15
40398000-40399000 rw-p 00002000 08:02 112715     /usr/lib/sasl/libcrammd5.so.1.0.15
40399000-403a0000 r-xp 00000000 08:02 112718     /usr/lib/sasl/libdigestmd5.so.0.0.17
403a0000-403a1000 rw-p 00006000 08:02 112718     /usr/lib/sasl/libdigestmd5.so.0.0.17
403a1000-403a3000 r-xp 00000000 08:02 112724     /usr/lib/sasl/libplain.so.1.0.14
403a3000-403a4000 rw-p 00001000 08:02 112724     /usr/lib/sasl/libplain.so.1.0.14
403a7000-403ac000 r-xp 00000000 08:03 73141      /lib/libcrypt-2.2.4.so
403ac000-403ad000 rw-p 00004000 08:03 73141      /lib/libcrypt-2.2.4.so
403ad000-403d4000 rw-p 00000000 00:00 0
403d8000-403d9000 r-xp 00000000 08:03 102716     /lib/security/pam_deny.so
403d9000-403da000 rw-p 00000000 08:03 102716     /lib/security/pam_deny.so
403da000-403dd000 r-xp 00000000 08:03 102717     /lib/security/pam_env.so
403dd000-403de000 rw-p 00002000 08:03 102717     /lib/security/pam_env.so
403de000-403e8000 r-xp 00000000 08:03 102588     /lib/security/pam_unix.so
403e8000-403ea000 rw-p 00009000 08:03 102588     /lib/security/pam_unix.so
403ea000-403f6000 rw-p 00000000 00:00 0
403f6000-403f9000 r-xp 00000000 08:03 102715     /lib/security/pam_cracklib.so
403f9000-403fa000 rw-p 00002000 08:03 102715     /lib/security/pam_cracklib.so
403fa000-403fe000 rw-p 00000000 00:00 0
403fe000-40401000 r-xp 00000000 08:03 102571     /lib/security/pam_limits.so
40401000-40402000 rw-p 00002000 08:03 102571     /lib/security/pam_limits.so
40404000-4040a000 r-xp 00000000 08:02 64334      /usr/lib/libcrack.so.2.7
4040a000-4040c000 rw-p 00005000 08:02 64334      /usr/lib/libcrack.so.2.7
4040c000-4040f000 rw-p 00000000 00:00 0
bfff8000-c0000000 rwxp ffff9000 00:00 0

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

Thanks.

 - Marc

-- 
Marc Lewis
Network Administrator
Blarg! Online Services, Inc.
http://www.blarg.net/~marc