You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Romer, Ted" <te...@amazon.com> on 2007/11/01 17:43:10 UTC

[users@httpd] Memory leak in 2.2.6 with long-lived connections and mod_proxy

Running Apache as a reverse proxy with long-lived client connections,
we're seeing memory consumption grow linearly in the number of
requests sent on the connection, to the tune of about 10 KB/request.
The consequence is that the memory footprint for each process is
determined by the longest-lived connection that process ever handles.
Our workaround is to lower MaxRequestsPerChild.  Googling turns up a
blog entry that describes the same symptoms and workaround:
http://www.modsecurity.org/blog/archives/2006/08/apache_reverse.html.

I've done some digging into the problem in hopes of finding a fix.  I
haven't found one, but I wanted to share what I've learned and get
suggestions on next steps.

This is with Apache 2.2.6, and we observe similar behavior with Apache
2.0.54.  We've also experimented with enabling/disabling keep-alive on
the downstream server, and see the same behavior.

I've run tests with between 50-1000 requests/connection and response
sizes of 10,000-100,000 bytes (the leak rate is independent of the
response size for this range).

All of the allocations are coming from the connection memory pool
(tagged "transaction").

According to valgrind+massif2, the problematic allocation point is
(line numbers are from 2.2.6):

  apr_bucket_alloc (apr_buckets_alloc.c:142)
  socket_bucket_read (apr_buckets_socket.c:34)
  ap_core_input_filter (core_filters.c:245)
  ap_get_brigade (util_filter.c:489)
  ap_http_filter (http_filters.c:349)
  ap_get_brigade (util_filter.c:489)
  ap_proxy_http_process_response (mod_proxy_http.c:1494)
  proxy_http_handler (mod_proxy_http.c:1742)
  proxy_run_scheme_handler (mod_proxy.c:2155)
  proxy_handler (mod_proxy.c:822)
  ap_run_handler (config.c:158)
  ap_invoke_handler (config.c:372)

If I understand apr_buckets_socket.c correctly, the bucket allocated
in socket_bucket_read is used to transfer data read from the
downstream server.  It is not freed until the upstream connection
closes.

My best guess is that ap_proxy_http_process_response should register a
callback with the request pool to clean up the relevant data structure,
but I'm unclear on exactly what the call should be and when it should
be registered.

Any suggestions would be very welcome.

Thanks!
Ted



Re: [users@httpd] mod_auth_dbmcookie.so (help!)

Posted by Jeff Kilbride <je...@kilbride.com>.
Thanks, Nick.

Unfortunately, it actually works quite well. I was hoping to continue using
it after upgrading. It has a nice feature that allows you to specify a login
URL, rather than using the basic popup box. I haven't looked around
recently, but are there any other mod_auth modules that have a login URL
configuration directive like this?

--jeff



> On Fri, 2 Nov 2007 10:35:07 -0700 (PDT)
> "Jeff Kilbride" <je...@kilbride.com> wrote:
>
>> After looking around yesterday, I still can't find any info on this
>> module.
>
> If anyone on this list had heard of it, they'd probably have said
> by now.  So if google is no help either, you can infer it's homebrew.
>
>> > LoadModule
>> > dbmcookie_auth_module /usr/lib/apache/1.3/mod_auth_dbmcookie.so
>
> In the days of 1.3, everyone was writing authentication modules.
> That includes lots of folks who would use scripting languages
> for any other kind of extra functionality.
>
> --
> Nick Kew
>
> Application Development with Apache - the Apache Modules Book
> http://www.apachetutor.org/
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_auth_dbmcookie.so (help!)

Posted by Nick Kew <ni...@webthing.com>.
On Fri, 2 Nov 2007 10:35:07 -0700 (PDT)
"Jeff Kilbride" <je...@kilbride.com> wrote:

> After looking around yesterday, I still can't find any info on this
> module.

If anyone on this list had heard of it, they'd probably have said
by now.  So if google is no help either, you can infer it's homebrew.

> > LoadModule
> > dbmcookie_auth_module /usr/lib/apache/1.3/mod_auth_dbmcookie.so

In the days of 1.3, everyone was writing authentication modules.
That includes lots of folks who would use scripting languages
for any other kind of extra functionality.

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_auth_dbmcookie.so (help!)

Posted by Jeff Kilbride <je...@kilbride.com>.
After looking around yesterday, I still can't find any info on this module.
Does anyone have any ideas on what other lists I can post this question to?
I'm not sure if it's appropriate for the dev lists.

Thanks,
--jeff



> I've recently taken over as sysadmin at a new company. The apache servers
> are using an auth module I've never seen before and can't find any
> information for on the web. The module is listed in the config as:
>
> LoadModule dbmcookie_auth_module /usr/lib/apache/1.3/mod_auth_dbmcookie.so
>
> The config for the module looks something like this:
>
> AuthPassiveEnable On
> AuthPassiveCookieUserName USER
> AuthPassiveCookiePassName PASS
> AuthPassiveCookieBackURL BackURL
> AuthPassiveLoginURL /auth/login.php
> AuthPassiveDBMSessFile /var/log/apache/session/session.db
> AuthPassiveGroups group1
>
> I'm just wondering if anyone has seen this before. I'm trying to find
> documentation on all the config options. I can't tell if this was something
> a previous admin wrote themselves or not. Any help would be greatly
> appreciated!
>
> Thanks,
> --jeff
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] mod_auth_dbmcookie.so (help!)

Posted by Jeff Kilbride <je...@kilbride.com>.
I've recently taken over as sysadmin at a new company. The apache servers
are using an auth module I've never seen before and can't find any
information for on the web. The module is listed in the config as:

LoadModule dbmcookie_auth_module /usr/lib/apache/1.3/mod_auth_dbmcookie.so

The config for the module looks something like this:

AuthPassiveEnable On
AuthPassiveCookieUserName USER
AuthPassiveCookiePassName PASS
AuthPassiveCookieBackURL BackURL
AuthPassiveLoginURL /auth/login.php
AuthPassiveDBMSessFile /var/log/apache/session/session.db
AuthPassiveGroups group1

I'm just wondering if anyone has seen this before. I'm trying to find
documentation on all the config options. I can't tell if this was something
a previous admin wrote themselves or not. Any help would be greatly
appreciated!

Thanks,
--jeff

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org