Seems i forgot to send reply to the dev list
---------- Forwarded message ----------
From: Christian BOITEL <[EMAIL PROTECTED]>
Date: 6 juin 2007 17:17
Subject: Re: reslist API does not provide proper size regulation
To: Aaron Bannert <[EMAIL PROTECTED]>
Find below the suggested patch for the 1.2.8: it took me time to answer for
i had the patch for 1.2.7 version but 1.2.8 was released and didn't find
time to investigate if patch would apply to 1.2.8 (time was found when i had
to upgrade to 1.2.8)
As you can see patch is quite simple and applies only to misc/apr_reslist.c.
My testes with Apache/Tomcat have shown that reslist now regulates (goes
down) even if an on-going activity is maintained.
Should i submit a new case if bugzilla to integrate this patch ?
Thank you,
Christian.
--- apr_reslist.c.original 2005-02-04 21:45:35.000000000 +0100
+++ apr_reslist.c 2007-06-06 09:22:14.000000000 +0200
@@ -80,7 +80,7 @@
*/
static void push_resource(apr_reslist_t *reslist, apr_res_t *resource)
{
- APR_RING_INSERT_TAIL(&reslist->avail_list, resource, apr_res_t, link);
+ APR_RING_INSERT_HEAD(&reslist->avail_list, resource, apr_res_t, link);
resource->freed = apr_time_now();
reslist->nidle++;
}
@@ -207,14 +207,15 @@
now = apr_time_now();
while (reslist->nidle > reslist->smax && reslist->nidle > 0) {
/* Peak at the first resource in the list */
- res = APR_RING_FIRST(&reslist->avail_list);
+ res = APR_RING_LAST(&reslist->avail_list);
/* See if the oldest entry should be expired */
if (now - res->freed < reslist->ttl) {
/* If this entry is too young, none of the others
* will be ready to be expired either, so we are done. */
break;
}
- res = pop_resource(reslist);
+ APR_RING_REMOVE(res, link);
+ reslist->nidle--;
reslist->ntotal--;
rv = destroy_resource(reslist, res);
free_container(reslist, res);
2006/9/6, Aaron Bannert <[EMAIL PROTECTED]>:
On Thu, Aug 31, 2006 at 07:06:10AM +0000, Christian BOITEL wrote:
> Following my discussion on this topic with rpluem on bugzilla, i am
posting this one to submit you a change in the reslit pool management to
ensure proper pool size regulation and some API changes to better handle
this part of the list management.
>
> See my initial toughts on
http://issues.apache.org/bugzilla/show_bug.cgi?id=40348
The failure of the reslist to shrink back down after load subsides does
sound like a valid bug to me. If you could provide a patch that changes
the
maint routine to search from the end of the list, and also a change to
make the list behave like a stack instead of a queue, that would be great.
As for changing the meaning of TTL, I'm not so sure that's needed after
the above changes. If you need to invalidate a resource, you can use the
apr_reslist_invalidate() routine. To implement a strict maximum lifetime
for your resources, simply check your own timer after aquiring a new
resource, and call the invalidate routine if it's too old, and then
try to get another resource.
-aaron