From: Willy Tarreau Date: Mon, 24 Jul 2017 15:35:27 +0000 (+0200) Subject: BUG/MINOR: lua: always detach the tcp/http tasks before freeing them X-Git-Tag: v1.8-dev3~214 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bd7fc95edbce821f1d7b745a7b75deef4d6b1e27;p=thirdparty%2Fhaproxy.git BUG/MINOR: lua: always detach the tcp/http tasks before freeing them In hlua_{http,tcp}_applet_release(), a call to task_free() is performed to release the task, but no task_delete() is made on these tasks. Till now it wasn't much of a problem because this was normally not done with the task in the run queue, and the task was never put into the wait queue since it doesn't have any timer. But with threading it will become an issue. And not having this already prevents another bug from being fixed. Thanks to Christopher for spotting this one. A backport to 1.7 and 1.6 is preferred for safety. --- diff --git a/src/hlua.c b/src/hlua.c index 35acff79cd..437f427bb8 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -6137,6 +6137,7 @@ error: static void hlua_applet_tcp_release(struct appctx *ctx) { + task_delete(ctx->ctx.hlua_apptcp.task); task_free(ctx->ctx.hlua_apptcp.task); ctx->ctx.hlua_apptcp.task = NULL; hlua_ctx_destroy(ctx->ctx.hlua_apptcp.hlua); @@ -6423,6 +6424,7 @@ error: static void hlua_applet_http_release(struct appctx *ctx) { + task_delete(ctx->ctx.hlua_apphttp.task); task_free(ctx->ctx.hlua_apphttp.task); ctx->ctx.hlua_apphttp.task = NULL; hlua_ctx_destroy(ctx->ctx.hlua_apphttp.hlua);