From: Willy Tarreau Date: Fri, 1 Sep 2023 05:27:56 +0000 (+0200) Subject: MINOR: checks: pin the check to its thread upon wakeup X-Git-Tag: v2.9-dev5~84 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3544c9f8a0a4121ce6d6ded1d6a8fbf880f7eb60;p=thirdparty%2Fhaproxy.git MINOR: checks: pin the check to its thread upon wakeup When a check leaves the sleeping state, we must pin it to the thread that is processing it. It's normally always the case after the first execution, but initial checks that start assigned to any thread (-1) could be assigned much later, causing problems with planned changes involving queuing. Thus better do it early, so that all threads start properly pinned. --- diff --git a/src/check.c b/src/check.c index fce152a96e..32c03da4c9 100644 --- a/src/check.c +++ b/src/check.c @@ -1157,6 +1157,9 @@ struct task *process_chk_conn(struct task *t, void *context, unsigned int state) return t; } } + + /* OK we're keeping it so this check is ours now */ + task_set_thread(t, tid); } if (check->server) @@ -1212,8 +1215,6 @@ struct task *process_chk_conn(struct task *t, void *context, unsigned int state) check->state |= CHK_ST_INPROGRESS; TRACE_STATE("init new health-check", CHK_EV_TASK_WAKE|CHK_EV_HCHK_START, check); - task_set_thread(t, tid); - check->current_step = NULL; check->sc = sc_new_from_check(check, SC_FL_NONE);