]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mworker/cli: rename mworker_cli_proxy_new_listener
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Thu, 3 Oct 2024 09:28:05 +0000 (11:28 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Oct 2024 20:02:39 +0000 (22:02 +0200)
This is the first commit in a series to add the support of 4 primary reload
use-cases for the new master-worker architecture:

1. Newly forked worker process dies before any reload, due to some errors in
   the configuration. Newly forked worker process crashes before any reload
   after sending its "READY" state to master.

2. Newly forked worker process dies due to some errors in the new
   configuration. This happens after reload, when this new configuration was
   supplied, so the previous worker process is still here.

3. Newly forked worker process crashes after sending its "READY" state to
   master due to some bugs. This happens after reload, so the previous worker
   process is still here.

4. Newly forked worker process has sent its "READY" state to master and starts
   to receive traffic. This happens after reload, the old worker hasn't
   terminated yet, as it is waiting on some idle connection and it crashes.

Let's rename in this commit mworker_cli_proxy_new_listener() to
mworker_cli_master_proxy_new_listener() to outline, that this function creates
"master-socket" bind conf and allocates a listener. This listener is attached
to the MASTER proxy and it's bound to the ipc_fd[0] of the sockpair,
inherited in master and in worker processes (master CLI sockpair).

include/haproxy/cli.h
src/cli.c
src/mworker.c

index 32c6599446025e593977171dc799c24e7e8eba2a..537f306e46cbb296067c7227ef2daae433aa6f1b 100644 (file)
@@ -42,7 +42,7 @@ int cli_parse_default(char **args, char *payload, struct appctx *appctx, void *p
 /* mworker proxy functions */
 
 int mworker_cli_proxy_create(void);
-struct bind_conf *mworker_cli_proxy_new_listener(char *line);
+struct bind_conf *mworker_cli_master_proxy_new_listener(char *line);
 int mworker_cli_sockpair_new(struct mworker_proc *mworker_proc, int proc);
 void mworker_cli_proxy_stop(void);
 
index c890eb3f8e50d8aae6dd8bf8c4f92dbb631bfe3e..ea9fcd6572392078bab42af5dbefd18d0f1738c5 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -3386,7 +3386,7 @@ error_proxy:
 /*
  * Create a new listener for the master CLI proxy
  */
-struct bind_conf *mworker_cli_proxy_new_listener(char *line)
+struct bind_conf *mworker_cli_master_proxy_new_listener(char *line)
 {
        struct bind_conf *bind_conf;
        struct listener *l;
index c47625c7614c673b89b89b7a068157e24cafb79d..c125a1696cece5329af73b3bda2c17c7d9a164d6 100644 (file)
@@ -809,8 +809,7 @@ void mworker_create_master_cli(void)
                }
 
                list_for_each_entry_safe(c, it, &mworker_cli_conf, list) {
-
-                       if (mworker_cli_proxy_new_listener(c->s) == NULL) {
+                       if (mworker_cli_master_proxy_new_listener(c->s) == NULL) {
                                ha_alert("Can't create the master's CLI.\n");
                                exit(EXIT_FAILURE);
                        }
@@ -835,7 +834,8 @@ void mworker_create_master_cli(void)
 
                /* Create the mcli_reload listener from the proc_self struct */
                memprintf(&path, "sockpair@%d", proc_self->ipc_fd[1]);
-               mcli_reload_bind_conf = mworker_cli_proxy_new_listener(path);
+
+               mcli_reload_bind_conf = mworker_cli_master_proxy_new_listener(path);
                if (mcli_reload_bind_conf == NULL) {
                        ha_alert("Can't create the mcli_reload listener.\n");
                        exit(EXIT_FAILURE);