]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: debug: make ha_task_dump() always check the task before dumping it
authorWilly Tarreau <w@1wt.eu>
Fri, 17 May 2019 08:39:47 +0000 (10:39 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 17 May 2019 15:16:20 +0000 (17:16 +0200)
For now it cannot happen since we're calling it from a task but it will
break with signals. No backport is needed.

src/debug.c

index 54f91d6238c17d2686680f6ec95cff9270d166dd..47bf6e53bbd5c66410330ae4f25fa6967edee494 100644 (file)
@@ -75,6 +75,11 @@ void ha_thread_dump(int thr)
  */
 void ha_task_dump(const struct task *task, const char *pfx)
 {
+       if (!curr_task) {
+               chunk_appendf(&trash, "0\n");
+               return;
+       }
+
        chunk_appendf(&trash,
                      "%p (%s) calls=%u last=%llu%s\n",
                      curr_task, TASK_IS_TASKLET(curr_task) ? "tasklet" : "task",