mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-16 18:51:08 +00:00
BUG/MINOR: mworker: PROC_O_LEAVING used but not updated
Since commit 2be557f
("MEDIUM: mworker: seamless reload use the internal
sockpair"), we are using the PROC_O_LEAVING flag to determine which
sockpair worker will be used with -x during the next reload.
However in mworker_reexec(), the PROC_O_LEAVING flag is not updated, it
is only updated at startup in mworker_env_to_proc_list().
This could be a problem when a remaining process is still in the list,
it could be selected as the current worker, and its socket will be used
even if _getsocks doesn't work anymore on it. (bug #1803)
This patch fixes the issue by updating the PROC_O_LEAVING flag in
mworker_proc_list_to_env() just before using it in mworker_reexec()
Must be backported to 2.6.
This commit is contained in:
parent
519cd2021b
commit
14b98ef1bd
@ -110,6 +110,7 @@ void mworker_proc_list_to_env()
|
||||
{
|
||||
char *msg = NULL;
|
||||
struct mworker_proc *child;
|
||||
int minreloads = INT_MAX; /* minimum number of reloads to chose which processes are "current" ones */
|
||||
|
||||
list_for_each_entry(child, &proc_list, list) {
|
||||
char type = '?';
|
||||
@ -121,11 +122,22 @@ void mworker_proc_list_to_env()
|
||||
else if (child->options &= PROC_O_TYPE_WORKER)
|
||||
type = 'w';
|
||||
|
||||
if (child->reloads < minreloads)
|
||||
minreloads = child->reloads;
|
||||
|
||||
if (child->pid > -1)
|
||||
memprintf(&msg, "%s|type=%c;fd=%d;pid=%d;reloads=%d;failedreloads=%d;timestamp=%d;id=%s;version=%s", msg ? msg : "", type, child->ipc_fd[0], child->pid, child->reloads, child->failedreloads, child->timestamp, child->id ? child->id : "", child->version);
|
||||
}
|
||||
if (msg)
|
||||
setenv("HAPROXY_PROCESSES", msg, 1);
|
||||
|
||||
list_for_each_entry(child, &proc_list, list) {
|
||||
if (child->reloads > minreloads && !(child->options & PROC_O_TYPE_MASTER)) {
|
||||
child->options |= PROC_O_LEAVING;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
struct mworker_proc *mworker_proc_new()
|
||||
|
Loading…
Reference in New Issue
Block a user