On Sat, Apr 14, 2018 at 2:18 AM, Yann Ylavic <ylavic....@gmail.com> wrote:
> when the ttl is to be
> checked against the resource we should always peek it as LIFO (i.e.
> s/fifo/1/ in the first peek_resource() of reslist_acquire() in my
> patch).
> This would prevent starvation, and we should possibly do that in 1.6.x
> too (where apr_reslist_acquire_fifo() can't land).
> If we do that unconditionnaly, this patch is moot. After all,
> apr_reslist_maintain() and/hence apr_reslist_release() are already
> LIFO for recycling resources.

IOW, this simple patch would work equally for me (and could go in any version):

Index: util-misc/apr_reslist.c
--- util-misc/apr_reslist.c    (revision 1829106)
+++ util-misc/apr_reslist.c    (working copy)
@@ -61,13 +61,13 @@ struct apr_reslist_t {

- * Grab a resource from the front of the resource list.
+ * Grab a resource from the back of the resource list.
  * Assumes: that the reslist is locked.
 static apr_res_t *pop_resource(apr_reslist_t *reslist)
     apr_res_t *res;
-    res = APR_RING_FIRST(&reslist->avail_list);
+    res = APR_RING_LAST(&reslist->avail_list);
     APR_RING_REMOVE(res, link);
     return res;

Except that for some reason it doesn't pass test_shrinking() in the
tests suite (neither is my patch).

Reply via email to