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.
This commit is contained in:
Willy Tarreau 2017-07-24 17:35:27 +02:00
parent d02210cd30
commit bd7fc95edb

View File

@ -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);