]> git.kaiwu.me - haproxy.git/commitdiff
MINOR: proxy: stress CLI commands with backends/servers loop master
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 21 Jul 2026 09:38:12 +0000 (11:38 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 21 Jul 2026 14:58:20 +0000 (16:58 +0200)
Update handlers for "show backend" and "show servers state/conn" so that
stress mode can be used to force the task yielding each time a new
instance is dumped.

This is useful for debugging commands safety with backend/server
deletion in parallel.

src/proxy.c

index 62b45b8c176a5110588b3cdf6883302050fbf59c..e69d8afddbba161798521862bf7545968660f280 100644 (file)
@@ -61,6 +61,7 @@
 #include <haproxy/stats.h>
 #include <haproxy/stconn.h>
 #include <haproxy/stream.h>
 #include <haproxy/stats.h>
 #include <haproxy/stconn.h>
 #include <haproxy/stream.h>
+#include <haproxy/stress.h>
 #include <haproxy/task.h>
 #include <haproxy/tcpcheck.h>
 #include <haproxy/thread.h>
 #include <haproxy/task.h>
 #include <haproxy/tcpcheck.h>
 #include <haproxy/thread.h>
@@ -4560,7 +4561,8 @@ static int dump_servers_state(struct appctx *appctx)
                        chunk_appendf(&trash, "\n");
                }
 
                        chunk_appendf(&trash, "\n");
                }
 
-               if (applet_putchk(appctx, &trash) == -1) {
+               if (STRESS_RUN1(applet_putchk_stress(appctx, &trash) == -1,
+                               applet_putchk(appctx, &trash) == -1)) {
                        return 0;
                }
        }
                        return 0;
                }
        }
@@ -4638,8 +4640,10 @@ static int cli_io_handler_show_backend(struct appctx *appctx)
                        continue;
 
                chunk_appendf(&trash, "%s\n", curproxy->id);
                        continue;
 
                chunk_appendf(&trash, "%s\n", curproxy->id);
-               if (applet_putchk(appctx, &trash) == -1)
+               if (STRESS_RUN1(applet_putchk_stress(appctx, &trash) == -1,
+                               applet_putchk(appctx, &trash) == -1)) {
                        return 0;
                        return 0;
+               }
        }
 
        return 1;
        }
 
        return 1;