From 64bca9d36ad8cb109cefa7cba3fd9ebba2eca8e0 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 25 Sep 2015 17:39:23 +0200 Subject: [PATCH] MINOR: applet: rename applet_runq to applet_active_queue This is not a real run queue and we're facing ugly bugs because if this : if a an applet removes another applet from the queue, typically the next one after itself, the list iterator loops forever because the list's backup pointer is not valid anymore. Before creating a run queue, let's rename this list. --- include/proto/applet.h | 4 ++-- src/applet.c | 4 ++-- src/haproxy.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/proto/applet.h b/include/proto/applet.h index 3e68b0085e..b256816b55 100644 --- a/include/proto/applet.h +++ b/include/proto/applet.h @@ -29,7 +29,7 @@ #include #include -extern struct list applet_runq; +extern struct list applet_active_queue; void applet_run_active(); @@ -75,7 +75,7 @@ static inline void appctx_free(struct appctx *appctx) static inline void appctx_wakeup(struct appctx *appctx) { if (LIST_ISEMPTY(&appctx->runq)) - LIST_ADDQ(&applet_runq, &appctx->runq); + LIST_ADDQ(&applet_active_queue, &appctx->runq); } /* removes an applet from the list of active applets */ diff --git a/src/applet.c b/src/applet.c index 481000a80b..cc467c49d7 100644 --- a/src/applet.c +++ b/src/applet.c @@ -19,14 +19,14 @@ #include #include -struct list applet_runq = LIST_HEAD_INIT(applet_runq); +struct list applet_active_queue = LIST_HEAD_INIT(applet_active_queue); void applet_run_active() { struct appctx *curr, *back; struct stream_interface *si; - list_for_each_entry_safe(curr, back, &applet_runq, runq) { + list_for_each_entry_safe(curr, back, &applet_active_queue, runq) { si = curr->owner; /* now we'll need a buffer */ diff --git a/src/haproxy.c b/src/haproxy.c index 465bb6a15a..a20f4977be 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -1524,7 +1524,7 @@ void run_poll_loop() break; /* expire immediately if events are pending */ - if (fd_cache_num || run_queue || signal_queue_len || !LIST_ISEMPTY(&applet_runq)) + if (fd_cache_num || run_queue || signal_queue_len || !LIST_ISEMPTY(&applet_active_queue)) next = now_ms; /* The poller will ensure it returns around */