0018-BUG-MINOR-lua-always-detach-the-tcp-http-tasks-befor.patch 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. From dd18f945c26fc30872a52c66b06b5a0a86b10060 Mon Sep 17 00:00:00 2001
  2. From: Willy Tarreau <w@1wt.eu>
  3. Date: Mon, 24 Jul 2017 17:35:27 +0200
  4. Subject: [PATCH 18/18] BUG/MINOR: lua: always detach the tcp/http tasks before
  5. freeing them
  6. In hlua_{http,tcp}_applet_release(), a call to task_free() is performed
  7. to release the task, but no task_delete() is made on these tasks. Till
  8. now it wasn't much of a problem because this was normally not done with
  9. the task in the run queue, and the task was never put into the wait queue
  10. since it doesn't have any timer. But with threading it will become an
  11. issue. And not having this already prevents another bug from being fixed.
  12. Thanks to Christopher for spotting this one. A backport to 1.7 and 1.6 is
  13. preferred for safety.
  14. (cherry picked from commit bd7fc95edbce821f1d7b745a7b75deef4d6b1e27)
  15. Signed-off-by: William Lallemand <wlallemand@haproxy.org>
  16. ---
  17. src/hlua.c | 2 ++
  18. 1 file changed, 2 insertions(+)
  19. diff --git a/src/hlua.c b/src/hlua.c
  20. index a998860e..67b9458c 100644
  21. --- a/src/hlua.c
  22. +++ b/src/hlua.c
  23. @@ -5948,6 +5948,7 @@ error:
  24. static void hlua_applet_tcp_release(struct appctx *ctx)
  25. {
  26. + task_delete(ctx->ctx.hlua_apptcp.task);
  27. task_free(ctx->ctx.hlua_apptcp.task);
  28. ctx->ctx.hlua_apptcp.task = NULL;
  29. hlua_ctx_destroy(&ctx->ctx.hlua_apptcp.hlua);
  30. @@ -6226,6 +6227,7 @@ error:
  31. static void hlua_applet_http_release(struct appctx *ctx)
  32. {
  33. + task_delete(ctx->ctx.hlua_apphttp.task);
  34. task_free(ctx->ctx.hlua_apphttp.task);
  35. ctx->ctx.hlua_apphttp.task = NULL;
  36. hlua_ctx_destroy(&ctx->ctx.hlua_apphttp.hlua);
  37. --
  38. 2.13.0