mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-12-10 12:11:28 +01:00
MINOR: check: do not increment global maxsock at runtime
global maxsock is used to estimate a number of fd to reserve for internal use, such as checks. It is incremented at startup with the info from the config file. Disable this incrementation in checks functions at runtime. First, it currently serves no purpose to increment it after startup. Worse, it may lead to out-of-bound accesse on the fdtab. This will be useful to initiate checks for dynamic servers.
This commit is contained in:
parent
3c2ab1a0d4
commit
403dce8e5a
24
src/check.c
24
src/check.c
@ -1647,6 +1647,12 @@ int init_srv_check(struct server *srv)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
srv->check.state |= CHK_ST_CONFIGURED | CHK_ST_ENABLED;
|
srv->check.state |= CHK_ST_CONFIGURED | CHK_ST_ENABLED;
|
||||||
|
|
||||||
|
/* Only increment maxsock for servers from the configuration. Dynamic
|
||||||
|
* servers at the moment are not taken into account for the estimation
|
||||||
|
* of the resources limits.
|
||||||
|
*/
|
||||||
|
if (global.mode & MODE_STARTING)
|
||||||
global.maxsock++;
|
global.maxsock++;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
@ -1696,6 +1702,12 @@ int init_srv_agent_check(struct server *srv)
|
|||||||
srv->agent.inter = srv->check.inter;
|
srv->agent.inter = srv->check.inter;
|
||||||
|
|
||||||
srv->agent.state |= CHK_ST_CONFIGURED | CHK_ST_ENABLED | CHK_ST_AGENT;
|
srv->agent.state |= CHK_ST_CONFIGURED | CHK_ST_ENABLED | CHK_ST_AGENT;
|
||||||
|
|
||||||
|
/* Only increment maxsock for servers from the configuration. Dynamic
|
||||||
|
* servers at the moment are not taken into account for the estimation
|
||||||
|
* of the resources limits.
|
||||||
|
*/
|
||||||
|
if (global.mode & MODE_STARTING)
|
||||||
global.maxsock++;
|
global.maxsock++;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
@ -1937,7 +1949,13 @@ static int srv_parse_agent_port(char **args, int *cur_arg, struct proxy *curpx,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Only increment maxsock for servers from the configuration. Dynamic
|
||||||
|
* servers at the moment are not taken into account for the estimation
|
||||||
|
* of the resources limits.
|
||||||
|
*/
|
||||||
|
if (global.mode & MODE_STARTING)
|
||||||
global.maxsock++;
|
global.maxsock++;
|
||||||
|
|
||||||
set_srv_agent_port(srv, atol(args[*cur_arg + 1]));
|
set_srv_agent_port(srv, atol(args[*cur_arg + 1]));
|
||||||
|
|
||||||
out:
|
out:
|
||||||
@ -2304,7 +2322,13 @@ static int srv_parse_check_port(char **args, int *cur_arg, struct proxy *curpx,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Only increment maxsock for servers from the configuration. Dynamic
|
||||||
|
* servers at the moment are not taken into account for the estimation
|
||||||
|
* of the resources limits.
|
||||||
|
*/
|
||||||
|
if (global.mode & MODE_STARTING)
|
||||||
global.maxsock++;
|
global.maxsock++;
|
||||||
|
|
||||||
srv->check.port = atol(args[*cur_arg+1]);
|
srv->check.port = atol(args[*cur_arg+1]);
|
||||||
/* if agentport was never set, we can use port */
|
/* if agentport was never set, we can use port */
|
||||||
if (!(srv->flags & SRV_F_AGENTPORT))
|
if (!(srv->flags & SRV_F_AGENTPORT))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user