Skip to content

Commit

Permalink
BUG/MINOR: startup: set GTUNE_SOCKET_TRANSFER correctly
Browse files Browse the repository at this point in the history
This bug was forbidding the GTUNE_SOCKET_TRANSFER option to be set
when haproxy is neither in daemon mode nor in mworker mode. So it
basically only impacts the foreground mode.

The fix moves the code outside the 'if (global.mode & (MODE_DAEMON |
MODE_MWORKER | MODE_MWORKER_WAIT))' condition.

Bug was introduced with 7f80eb2 ("MEDIUM: proxy: zombify proxies only
when the expose-fd socket is bound").

Must be backported in every stable version.

(cherry picked from commit ef9a195)
Signed-off-by: Christopher Faulet <[email protected]>
(cherry picked from commit a51c3e1)
[cf: ctx adjt]
Signed-off-by: Christopher Faulet <[email protected]>
(cherry picked from commit ef066d6)
Signed-off-by: Christopher Faulet <[email protected]>
(cherry picked from commit 3f02755)
[wla: use pid_bit for nbproc handling]
Signed-off-by: William Lallemand <[email protected]>
(cherry picked from commit def2f95)
Signed-off-by: Christopher Faulet <[email protected]>
(cherry picked from commit 586a2ed)
Signed-off-by: Christopher Faulet <[email protected]>
  • Loading branch information
wlallemand authored and capflam committed Dec 15, 2023
1 parent 5256c34 commit 2465b2d
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions src/haproxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -3482,23 +3482,6 @@ int main(int argc, char **argv)
exit(1);
}

/* pass through every cli socket, and check if it's bound to
* the current process and if it exposes listeners sockets.
* Caution: the GTUNE_SOCKET_TRANSFER is now set after the fork.
* */

if (global.stats_fe) {
struct bind_conf *bind_conf;

list_for_each_entry(bind_conf, &global.stats_fe->conf.bind, by_fe) {
if (bind_conf->level & ACCESS_FD_LISTENERS) {
if (!bind_conf->bind_proc || bind_conf->bind_proc & (1UL << proc)) {
global.tune.options |= GTUNE_SOCKET_TRANSFER;
break;
}
}
}
}

/* we might have to unbind some proxies from some processes */
px = proxies_list;
Expand Down Expand Up @@ -3553,6 +3536,24 @@ int main(int argc, char **argv)
fork_poller();
}

/* pass through every cli socket, and check if it's bound to
* the current process and if it exposes listeners sockets.
* Caution: the GTUNE_SOCKET_TRANSFER is now set after the fork.
* */

if (global.stats_fe) {
struct bind_conf *bind_conf;

list_for_each_entry(bind_conf, &global.stats_fe->conf.bind, by_fe) {
if (bind_conf->level & ACCESS_FD_LISTENERS) {
if (!bind_conf->bind_proc || bind_conf->bind_proc & pid_bit) {
global.tune.options |= GTUNE_SOCKET_TRANSFER;
break;
}
}
}
}

/* try our best to re-enable core dumps depending on system capabilities.
* What is addressed here :
* - remove file size limits
Expand Down

0 comments on commit 2465b2d

Please sign in to comment.