Hi!

On Tue, Sep 24, 2024 at 02:23:03PM +0000, PR Bot wrote:
> From 16e8060fbdcf21beeb762096879f58b55afadc74 Mon Sep 17 00:00:00 2001
> From: Oliver Dala <o.d...@ixolit.com>
> Date: Tue, 24 Sep 2024 15:27:42 +0200
> Subject: [PATCH] pass PROXY_LOCK status through dequeue_proxy_listeners
> 
> ---
>  include/haproxy/listener.h | 2 +-
>  src/listener.c             | 8 ++++----
>  src/proxy.c                | 4 ++--
>  3 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/include/haproxy/listener.h b/include/haproxy/listener.h
> index 3627a791e85e..fb32f2e89b16 100644
> --- a/include/haproxy/listener.h
> +++ b/include/haproxy/listener.h
> @@ -94,7 +94,7 @@ void enable_listener(struct listener *listener);
>  void dequeue_all_listeners(void);
>  
>  /* Dequeues all listeners waiting for a resource in proxy <px>'s queue */
> -void dequeue_proxy_listeners(struct proxy *px);
> +void dequeue_proxy_listeners(struct proxy *px, int lpx);
>  
>  /* This function closes the listening socket for the specified listener,
>   * provided that it's already in a listening state. The listener enters the
> diff --git a/src/listener.c b/src/listener.c
> index d32551a24d01..f9002cc7ea9c 100644
> --- a/src/listener.c
> +++ b/src/listener.c
> @@ -708,7 +708,7 @@ void dequeue_all_listeners()
>  }
>  
>  /* Dequeues all listeners waiting for a resource in proxy <px>'s queue */
> -void dequeue_proxy_listeners(struct proxy *px)
> +void dequeue_proxy_listeners(struct proxy *px, int lpx)
>  {
>       struct listener *listener;
>  
> @@ -716,7 +716,7 @@ void dequeue_proxy_listeners(struct proxy *px)
>               /* This cannot fail because the listeners are by definition in
>                * the LI_LIMITED state.
>                */
> -             relax_listener(listener, 0, 0);
> +             relax_listener(listener, lpx, 0);
>       }
>  }
>  
> @@ -1558,7 +1558,7 @@ void listener_accept(struct listener *l)
>  
>               if (p && !MT_LIST_ISEMPTY(&p->listener_queue) &&
>                   (!p->fe_sps_lim || 
> freq_ctr_remain(&p->fe_counters.sess_per_sec, p->fe_sps_lim, 0) > 0))
> -                     dequeue_proxy_listeners(p);
> +                     dequeue_proxy_listeners(p, 0);
>       }
>       return;
>  
> @@ -1617,7 +1617,7 @@ void listener_release(struct listener *l)
>  
>       if (fe && !MT_LIST_ISEMPTY(&fe->listener_queue) &&
>           (!fe->fe_sps_lim || freq_ctr_remain(&fe->fe_counters.sess_per_sec, 
> fe->fe_sps_lim, 0) > 0))
> -             dequeue_proxy_listeners(fe);
> +             dequeue_proxy_listeners(fe, 0);
>       else {
>               unsigned int wait;
>               int expire = TICK_ETERNITY;
> diff --git a/src/proxy.c b/src/proxy.c
> index 25dd136dadd4..562bb827cc00 100644
> --- a/src/proxy.c
> +++ b/src/proxy.c
> @@ -1999,7 +1999,7 @@ struct task *manage_proxy(struct task *t, void 
> *context, unsigned int state)
>       }
>  
>       /* The proxy is not limited so we can re-enable any waiting listener */
> -     dequeue_proxy_listeners(p);
> +     dequeue_proxy_listeners(p, 0);
>   out:
>       t->expire = next;
>       task_queue(t);
> @@ -3010,7 +3010,7 @@ static int cli_parse_set_maxconn_frontend(char **args, 
> char *payload, struct app
>       }
>  
>       if (px->maxconn > px->feconn)
> -             dequeue_proxy_listeners(px);
> +             dequeue_proxy_listeners(px, 1);
>  
>       HA_RWLOCK_WRUNLOCK(PROXY_LOCK, &px->lock);
>  

Nice catch! Apparently it was introduced in 2.9 with commit ff1c803279
("BUG/MEDIUM: listener: Acquire proxy's lock in relax_listener() if
necessary") which was backported to 2.4, so it will need to be backported
there.

Do you have a commit message to propose that explains how the bug
manifests or should I do it myself ?

Thanks,
Willy


Reply via email to