]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: debug: make "show threads" properly iterate over all threads
authorWilly Tarreau <w@1wt.eu>
Thu, 4 May 2023 17:07:56 +0000 (19:07 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 4 May 2023 17:15:50 +0000 (19:15 +0200)
Previously it would re-dump all threads to the same trash if  the output
buffer was full, which it never was since the trash is of the same size.
Now it dumps one thread, copies it to the buffer and yields until it can
continue. Showing 256 threads works as expected.

src/debug.c

index a710f36b048d80f131512b42c656f4bfb50cc7a4..d23904d70a3e42a518851a2ec9e7463add01ca5f 100644 (file)
@@ -370,14 +370,18 @@ static int cli_io_handler_show_threads(struct appctx *appctx)
        else
                thr = 0;
 
-       chunk_reset(&trash);
-       ha_thread_dump_all_to_trash();
+       do {
+               chunk_reset(&trash);
+               ha_thread_dump(&trash, thr);
+
+               if (applet_putchk(appctx, &trash) == -1) {
+                       /* failed, try again */
+                       appctx->st1 = thr;
+                       return 0;
+               }
+               thr++;
+       } while (thr < global.nbthread);
 
-       if (applet_putchk(appctx, &trash) == -1) {
-               /* failed, try again */
-               appctx->st1 = thr;
-               return 0;
-       }
        return 1;
 }