Bug 42749

Summary: Loading mod_authz_host without mod_auth_digest causes ~1Mb leak per graceful restart
Product: Apache httpd-2 Reporter: Aseem Mohanty <amohanty>
Component: CoreAssignee: Apache HTTPD Bugs Mailing List <bugs>
Status: RESOLVED INVALID    
Severity: normal CC: amohanty
Priority: P2    
Version: 2.5-HEAD   
Target Milestone: ---   
Hardware: Other   
OS: Linux   

Description Aseem Mohanty 2007-06-26 15:35:39 UTC
In a vanilla apache2.2.x configuration if I only load mod_authz_host and none of
the other mod_auth* modules, every graceful restart causes ~1Mb leak in the
parent process.

Steps to reproduce:
Gentoo:
1. In /etc/apache2/httd.conf comment out all "LoadModule auth*" directives except 
LoadModule authz_host_module modules/mod_authz_host.so

Ubuntu Feisty:
1. In /etc/apache2/mods-enabled rename auth*.load files except authz_host.load
to auth*.load.not

2. Start apache
3. Track apache parent process: top -d1 -p $(pgrep -o apache)
4. Hit apache instances with graceful restarts:
for i in $(seq 150); do echo $i; kill -USR1 $(pgrep -o apache); sleep 2 done

In this case the parent will leak ~1Mb per restart. If however in each of the
configurations mod_auth_digest.so is also loaded the leak is only about 150-200K
or so per graceful restart. This is on a server with 0 load. In my case it
caused apache instances that were restarted every 55 minutes to grow up to 300Mb
in a week.

Tested on:
1. gentoo (64 bit dual proc AMD): 
Linux host1 2.6.16-gentoo-r9 #7 SMP Fri Mar 16 17:35:26 UTC 2007 x86_64 AMD
Opteron(tm) Processor 248 AuthenticAMD GNU/Linux

Server version: Apache/2.2.4 (Unix)
Server built:   Jun 26 2007 19:29:33
Server's Module Magic Number: 20051115:4
Server loaded:  APR 1.2.8, APR-Util 1.2.8
Compiled using: APR 1.2.8, APR-Util 1.2.8
Architecture:   64-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT="/usr"
 -D SUEXEC_BIN="/usr/sbin/suexec"
 -D DEFAULT_PIDLOG="/var/run/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="/var/run/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="/etc/apache2/mime.types"
 -D SERVER_CONFIG_FILE="/etc/apache2/httpd.conf"

2. Ubuntu Feisty (32 bit Intel core duo):
Linux host2 2.6.20-16-generic #2 SMP Thu Jun 7 20:19:32 UTC 2007 i686 GNU/Linux

Server version: Apache/2.2.3
Server built:   Jan 15 2007 18:14:50
Server's Module Magic Number: 20051115:3
Server loaded:  APR 1.2.7, APR-Util 1.2.7
Compiled using: APR 1.2.7, APR-Util 1.2.7
Architecture:   32-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT=""
 -D SUEXEC_BIN="/usr/lib/apache2/suexec"
 -D DEFAULT_PIDLOG="/var/run/apache2.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="/var/run/apache2/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="/etc/apache2/mime.types"
 -D SERVER_CONFIG_FILE="/etc/apache2/apache2.conf"
Comment 1 Ruediger Pluem 2007-06-27 01:36:25 UTC
Sorry but I cannot reproduce this behaviour. So my closest guess for now would
be that Gentoo / Ubuntu added further patches to their httpd binaries that cause
this behaviour or that you are using a 3rd party module that causes this. Please
check if you can reproduce this behaviour if you compile httpd by yourself from
the sources at httpd.apache.org.
Comment 2 Aseem Mohanty 2007-06-27 09:59:22 UTC
It appears you are correct. A base install from source using:

./configure --prefix=/opt --enable-modules=all --enable-mods-shared=all
--enable-so --with-included-apr

does not display this behaviour. I failed to mention that we do use mod_python
and as soon as I throw in mod_python the mix, the behaviour is back. 

Oh well, time to file a bug against mod_python I guess.

Thanks.
Comment 3 Ruediger Pluem 2007-06-27 11:35:16 UTC
Thanks for your feedback. Based on your reply I mark this report as invalid.