You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2010/05/10 22:47:59 UTC
svn commit: r942897 - in /httpd/httpd/trunk: CHANGES
server/mpm/prefork/prefork.c
Author: trawick
Date: Mon May 10 20:47:59 2010
New Revision: 942897
URL: http://svn.apache.org/viewvc?rev=942897&view=rev
Log:
prefork MPM: Run cleanups for final request when process exits gracefully.
PR: 43857
Submitted by: Tom Donovan, simplified slightly by me
Modified:
httpd/httpd/trunk/CHANGES
httpd/httpd/trunk/server/mpm/prefork/prefork.c
Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=942897&r1=942896&r2=942897&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Mon May 10 20:47:59 2010
@@ -28,6 +28,9 @@ Changes with Apache 2.3.7
processing is completed, avoiding orphaned callback pointers.
[Brett Gervasoni <brettg senseofsecurity.com>, Jeff Trawick]
+ *) prefork MPM: Run cleanups for final request when process exits gracefully.
+ PR 43857. [Tom Donovan, Jeff Trawick]
+
*) ab: fix number of requests sent by ab when keepalive is enabled. PR 48497.
[Bryn Dole <dole blekko.com>]
Modified: httpd/httpd/trunk/server/mpm/prefork/prefork.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/prefork/prefork.c?rev=942897&r1=942896&r2=942897&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/prefork/prefork.c (original)
+++ httpd/httpd/trunk/server/mpm/prefork/prefork.c Mon May 10 20:47:59 2010
@@ -549,12 +549,6 @@ static void child_main(int child_num_arg
conn_rec *current_conn;
void *csd;
- /*
- * (Re)initialize this child to a pre-connection state.
- */
-
- apr_pool_clear(ptrans);
-
if ((ap_max_requests_per_child > 0
&& requests_this_child++ >= ap_max_requests_per_child)) {
clean_child_exit(0);
@@ -668,6 +662,12 @@ static void child_main(int child_num_arg
ap_lingering_close(current_conn);
}
+ /*
+ * (Re)initialize this child to a pre-connection state.
+ */
+
+ apr_pool_clear(ptrans);
+
/* Check the pod and the generation number after processing a
* connection so that we'll go away if a graceful restart occurred
* while we were processing the connection or we are the lucky
Re: svn commit: r942897 - in /httpd/httpd/trunk: CHANGES
server/mpm/prefork/prefork.c
Posted by Jeff Trawick <tr...@gmail.com>.
On Thu, May 13, 2010 at 4:43 AM, Ruediger Pluem <rp...@apache.org> wrote:
> On 10.05.2010 22:47, trawick@apache.org wrote:
>> Author: trawick
>> Date: Mon May 10 20:47:59 2010
>> New Revision: 942897
>>
>> URL: http://svn.apache.org/viewvc?rev=942897&view=rev
>> Log:
>> prefork MPM: Run cleanups for final request when process exits gracefully.
>> PR: 43857
>> Submitted by: Tom Donovan, simplified slightly by me
>>
>> Modified:
>> httpd/httpd/trunk/CHANGES
>> httpd/httpd/trunk/server/mpm/prefork/prefork.c
>>
>> Modified: httpd/httpd/trunk/CHANGES
>> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=942897&r1=942896&r2=942897&view=diff
>> ==============================================================================
>> --- httpd/httpd/trunk/CHANGES [utf-8] (original)
>> +++ httpd/httpd/trunk/CHANGES [utf-8] Mon May 10 20:47:59 2010
>> @@ -28,6 +28,9 @@ Changes with Apache 2.3.7
>> processing is completed, avoiding orphaned callback pointers.
>> [Brett Gervasoni <brettg senseofsecurity.com>, Jeff Trawick]
>>
>> + *) prefork MPM: Run cleanups for final request when process exits gracefully.
>> + PR 43857. [Tom Donovan, Jeff Trawick]
>> +
>> *) ab: fix number of requests sent by ab when keepalive is enabled. PR 48497.
>> [Bryn Dole <dole blekko.com>]
>>
>>
>> Modified: httpd/httpd/trunk/server/mpm/prefork/prefork.c
>> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/prefork/prefork.c?rev=942897&r1=942896&r2=942897&view=diff
>> ==============================================================================
>> --- httpd/httpd/trunk/server/mpm/prefork/prefork.c (original)
>> +++ httpd/httpd/trunk/server/mpm/prefork/prefork.c Mon May 10 20:47:59 2010
>> @@ -549,12 +549,6 @@ static void child_main(int child_num_arg
>> conn_rec *current_conn;
>> void *csd;
>>
>> - /*
>> - * (Re)initialize this child to a pre-connection state.
>> - */
>> -
>> - apr_pool_clear(ptrans);
>> -
>
> Doesn't this create a memory leak? Don't we need to reset this pool for every
> new connection?
This original commit had a potential leak when apr_socket_accept()
failed, but it did clear the pool at the end of handling a
successfully-accepted connection. The final commit should handle
either situation.
Re: svn commit: r942897 - in /httpd/httpd/trunk: CHANGES server/mpm/prefork/prefork.c
Posted by Rainer Jung <ra...@kippdata.de>.
Rüdiger,
Jeff rolled back this change in r943648 after a comment by Joe and
committed an alternative approach in r943650.
Regards,
Rainer
On 13.05.2010 10:43, Ruediger Pluem wrote:
> On 10.05.2010 22:47, trawick@apache.org wrote:
>> Author: trawick
>> Date: Mon May 10 20:47:59 2010
>> New Revision: 942897
>>
>> URL: http://svn.apache.org/viewvc?rev=942897&view=rev
>> Log:
>> prefork MPM: Run cleanups for final request when process exits gracefully.
>> PR: 43857
>> Submitted by: Tom Donovan, simplified slightly by me
>>
>> Modified:
>> httpd/httpd/trunk/CHANGES
>> httpd/httpd/trunk/server/mpm/prefork/prefork.c
>>
>> Modified: httpd/httpd/trunk/CHANGES
>> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=942897&r1=942896&r2=942897&view=diff
>> ==============================================================================
>> --- httpd/httpd/trunk/CHANGES [utf-8] (original)
>> +++ httpd/httpd/trunk/CHANGES [utf-8] Mon May 10 20:47:59 2010
>> @@ -28,6 +28,9 @@ Changes with Apache 2.3.7
>> processing is completed, avoiding orphaned callback pointers.
>> [Brett Gervasoni<brettg senseofsecurity.com>, Jeff Trawick]
>>
>> + *) prefork MPM: Run cleanups for final request when process exits gracefully.
>> + PR 43857. [Tom Donovan, Jeff Trawick]
>> +
>> *) ab: fix number of requests sent by ab when keepalive is enabled. PR 48497.
>> [Bryn Dole<dole blekko.com>]
>>
>>
>> Modified: httpd/httpd/trunk/server/mpm/prefork/prefork.c
>> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/prefork/prefork.c?rev=942897&r1=942896&r2=942897&view=diff
>> ==============================================================================
>> --- httpd/httpd/trunk/server/mpm/prefork/prefork.c (original)
>> +++ httpd/httpd/trunk/server/mpm/prefork/prefork.c Mon May 10 20:47:59 2010
>> @@ -549,12 +549,6 @@ static void child_main(int child_num_arg
>> conn_rec *current_conn;
>> void *csd;
>>
>> - /*
>> - * (Re)initialize this child to a pre-connection state.
>> - */
>> -
>> - apr_pool_clear(ptrans);
>> -
>
> Doesn't this create a memory leak? Don't we need to reset this pool for every
> new connection?
>
> Regards
>
> Rüdiger
Re: svn commit: r942897 - in /httpd/httpd/trunk: CHANGES server/mpm/prefork/prefork.c
Posted by Ruediger Pluem <rp...@apache.org>.
On 10.05.2010 22:47, trawick@apache.org wrote:
> Author: trawick
> Date: Mon May 10 20:47:59 2010
> New Revision: 942897
>
> URL: http://svn.apache.org/viewvc?rev=942897&view=rev
> Log:
> prefork MPM: Run cleanups for final request when process exits gracefully.
> PR: 43857
> Submitted by: Tom Donovan, simplified slightly by me
>
> Modified:
> httpd/httpd/trunk/CHANGES
> httpd/httpd/trunk/server/mpm/prefork/prefork.c
>
> Modified: httpd/httpd/trunk/CHANGES
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=942897&r1=942896&r2=942897&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/CHANGES [utf-8] (original)
> +++ httpd/httpd/trunk/CHANGES [utf-8] Mon May 10 20:47:59 2010
> @@ -28,6 +28,9 @@ Changes with Apache 2.3.7
> processing is completed, avoiding orphaned callback pointers.
> [Brett Gervasoni <brettg senseofsecurity.com>, Jeff Trawick]
>
> + *) prefork MPM: Run cleanups for final request when process exits gracefully.
> + PR 43857. [Tom Donovan, Jeff Trawick]
> +
> *) ab: fix number of requests sent by ab when keepalive is enabled. PR 48497.
> [Bryn Dole <dole blekko.com>]
>
>
> Modified: httpd/httpd/trunk/server/mpm/prefork/prefork.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/prefork/prefork.c?rev=942897&r1=942896&r2=942897&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/server/mpm/prefork/prefork.c (original)
> +++ httpd/httpd/trunk/server/mpm/prefork/prefork.c Mon May 10 20:47:59 2010
> @@ -549,12 +549,6 @@ static void child_main(int child_num_arg
> conn_rec *current_conn;
> void *csd;
>
> - /*
> - * (Re)initialize this child to a pre-connection state.
> - */
> -
> - apr_pool_clear(ptrans);
> -
Doesn't this create a memory leak? Don't we need to reset this pool for every
new connection?
Regards
Rüdiger
Re: svn commit: r942897 - in /httpd/httpd/trunk: CHANGES
server/mpm/prefork/prefork.c
Posted by Jeff Trawick <tr...@gmail.com>.
On Wed, May 19, 2010 at 5:26 PM, Joe Orton <jo...@redhat.com> wrote:
> On Wed, May 12, 2010 at 03:30:29PM -0400, Jeff Trawick wrote:
>> The multiple-calls-to-pool_clear solution is definitely safer.
>
> OK, so now I reviewed that too ;) The only difference between:
>
> apr_pool_clear(ptrans);
> apr_pool_destroy(pchild);
>
> and simply:
>
> apr_pool_destroy(pchild);
>
> (given that ptrans is a child of ptrans and _destroy runs cleanups in
> child pools)
>
> is that it hides problems in cleanup ordering/pool nesting.
hmmm, definitely a negative characteristic... too bad it is
(apparently) rolled up in the following issue
> I think PR 43857 is about the reslist cleanup issue in APR-util, r677505
> and all that. Not sure what the status of that is.
main, initial discussion ends here:
http://marc.info/?l=apr-dev&m=121728874016894&w=3
meanwhile, unreleased apr trunk and unreleased apr-util 1.4.x have
APU_DECLARE(void) apr_reslist_cleanup_order_set(apr_reslist_t *rl,
apr_uint32_t mode)
{
apr_pool_cleanup_kill(rl->pool, rl, reslist_cleanup);
if (mode == APR_RESLIST_CLEANUP_FIRST)
apr_pool_pre_cleanup_register(rl->pool, rl, reslist_cleanup);
else
apr_pool_cleanup_register(rl->pool, rl, reslist_cleanup,
apr_pool_cleanup_null);
}
and apr_memcache uses that
discussion of backporting seems to have stopped at this point:
http://marc.info/?l=apr-dev&m=121661852120171&w=3
Re: svn commit: r942897 - in /httpd/httpd/trunk: CHANGES
server/mpm/prefork/prefork.c
Posted by Jeff Trawick <tr...@gmail.com>.
On Wed, May 19, 2010 at 5:26 PM, Joe Orton <jo...@redhat.com> wrote:
> On Wed, May 12, 2010 at 03:30:29PM -0400, Jeff Trawick wrote:
>> The multiple-calls-to-pool_clear solution is definitely safer.
>
> OK, so now I reviewed that too ;) The only difference between:
>
> apr_pool_clear(ptrans);
> apr_pool_destroy(pchild);
>
> and simply:
>
> apr_pool_destroy(pchild);
>
> (given that ptrans is a child of ptrans and _destroy runs cleanups in
> child pools)
>
> is that it hides problems in cleanup ordering/pool nesting.
hmmm, definitely a negative characteristic... too bad it is
(apparently) rolled up in the following issue
> I think PR 43857 is about the reslist cleanup issue in APR-util, r677505
> and all that. Not sure what the status of that is.
main, initial discussion ends here:
http://marc.info/?l=apr-dev&m=121728874016894&w=3
meanwhile, unreleased apr trunk and unreleased apr-util 1.4.x have
APU_DECLARE(void) apr_reslist_cleanup_order_set(apr_reslist_t *rl,
apr_uint32_t mode)
{
apr_pool_cleanup_kill(rl->pool, rl, reslist_cleanup);
if (mode == APR_RESLIST_CLEANUP_FIRST)
apr_pool_pre_cleanup_register(rl->pool, rl, reslist_cleanup);
else
apr_pool_cleanup_register(rl->pool, rl, reslist_cleanup,
apr_pool_cleanup_null);
}
and apr_memcache uses that
discussion of backporting seems to have stopped at this point:
http://marc.info/?l=apr-dev&m=121661852120171&w=3
Re: svn commit: r942897 - in /httpd/httpd/trunk: CHANGES
server/mpm/prefork/prefork.c
Posted by Joe Orton <jo...@redhat.com>.
On Wed, May 12, 2010 at 03:30:29PM -0400, Jeff Trawick wrote:
> The multiple-calls-to-pool_clear solution is definitely safer.
OK, so now I reviewed that too ;) The only difference between:
apr_pool_clear(ptrans);
apr_pool_destroy(pchild);
and simply:
apr_pool_destroy(pchild);
(given that ptrans is a child of ptrans and _destroy runs cleanups in
child pools)
is that it hides problems in cleanup ordering/pool nesting.
I think PR 43857 is about the reslist cleanup issue in APR-util, r677505
and all that. Not sure what the status of that is.
Regards, Joe
Re: svn commit: r942897 - in /httpd/httpd/trunk: CHANGES
server/mpm/prefork/prefork.c
Posted by Joe Orton <jo...@redhat.com>.
On Wed, May 12, 2010 at 03:30:29PM -0400, Jeff Trawick wrote:
> The multiple-calls-to-pool_clear solution is definitely safer.
OK, so now I reviewed that too ;) The only difference between:
apr_pool_clear(ptrans);
apr_pool_destroy(pchild);
and simply:
apr_pool_destroy(pchild);
(given that ptrans is a child of ptrans and _destroy runs cleanups in
child pools)
is that it hides problems in cleanup ordering/pool nesting.
I think PR 43857 is about the reslist cleanup issue in APR-util, r677505
and all that. Not sure what the status of that is.
Regards, Joe
Re: svn commit: r942897 - in /httpd/httpd/trunk: CHANGES
server/mpm/prefork/prefork.c
Posted by Jeff Trawick <tr...@gmail.com>.
On Wed, May 12, 2010 at 4:24 AM, Joe Orton <jo...@redhat.com> wrote:
> On Mon, May 10, 2010 at 08:47:59PM -0000, Jeff Trawick wrote:
>> --- httpd/httpd/trunk/server/mpm/prefork/prefork.c (original)
>> +++ httpd/httpd/trunk/server/mpm/prefork/prefork.c Mon May 10 20:47:59 2010
>> @@ -549,12 +549,6 @@ static void child_main(int child_num_arg
>> conn_rec *current_conn;
>> void *csd;
>>
>> - /*
>> - * (Re)initialize this child to a pre-connection state.
>> - */
>> -
>> - apr_pool_clear(ptrans);
>> -
>
> ptrans will not be cleared between loop iterations in the case where
> accept fails (the "continue" path) - isn't that a potential memory leak?
If the accept() call itself fails, I don't think it will leak with
current code; if something in APR after accept() fails (probably
should-not-occur), then yes.
The multiple-calls-to-pool_clear solution is definitely safer.
(Thanks!)
Re: svn commit: r942897 - in /httpd/httpd/trunk: CHANGES
server/mpm/prefork/prefork.c
Posted by Joe Orton <jo...@redhat.com>.
On Mon, May 10, 2010 at 08:47:59PM -0000, Jeff Trawick wrote:
> --- httpd/httpd/trunk/server/mpm/prefork/prefork.c (original)
> +++ httpd/httpd/trunk/server/mpm/prefork/prefork.c Mon May 10 20:47:59 2010
> @@ -549,12 +549,6 @@ static void child_main(int child_num_arg
> conn_rec *current_conn;
> void *csd;
>
> - /*
> - * (Re)initialize this child to a pre-connection state.
> - */
> -
> - apr_pool_clear(ptrans);
> -
ptrans will not be cleared between loop iterations in the case where
accept fails (the "continue" path) - isn't that a potential memory leak?
Regards, Joe