- Add new patches (see https://www.haproxy.org/bugs/bugs-1.8.8.html) - Raise patch-level to 02 Signed-off-by: Christian Lachner <gladiac@gmail.com>
36 lines
1.4 KiB
Diff
36 lines
1.4 KiB
Diff
commit 8b8d55be7e94ee3d758d41a21fa86a036e91a264
|
|
Author: Christopher Faulet <cfaulet@haproxy.com>
|
|
Date: Wed Apr 25 10:34:45 2018 +0200
|
|
|
|
BUG/MINOR: lua/threads: Make lua's tasks sticky to the current thread
|
|
|
|
PiBa-NL reported a bug with tasks registered in lua when HAProxy is started with
|
|
serveral threads. These tasks have not specific affinity with threads so they
|
|
can be woken up on any threads. So, it is impossbile for these tasks to handled
|
|
cosockets or applets, because cosockets and applets are sticky on the thread
|
|
which created them. It is forbbiden to manipulate a cosocket from another
|
|
thread.
|
|
|
|
So to fix the bug, tasks registered in lua are now sticky to the current
|
|
thread. Because these tasks can be registered before threads creation, the
|
|
affinity is set the first time a lua's task is processed.
|
|
|
|
This patch must be backported in HAProxy 1.8.
|
|
|
|
(cherry picked from commit 5bc9972ed836517924eea91954d255d317a53418)
|
|
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
|
|
|
|
diff --git a/src/hlua.c b/src/hlua.c
|
|
index d4b7ce91..bd0b87e3 100644
|
|
--- a/src/hlua.c
|
|
+++ b/src/hlua.c
|
|
@@ -5513,6 +5513,9 @@ static struct task *hlua_process_task(struct task *task)
|
|
struct hlua *hlua = task->context;
|
|
enum hlua_exec status;
|
|
|
|
+ if (task->thread_mask == MAX_THREADS_MASK)
|
|
+ task_set_affinity(task, tid_bit);
|
|
+
|
|
/* If it is the first call to the task, we must initialize the
|
|
* execution timeouts.
|
|
*/
|