mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-28 14:21:00 +01:00
MINOR: startup: rename and adapt reexec_on_failure
Previously reexec_on_failure() was called in cases when the process has failed after reload, while it was parsing its configuration or it was trying to apply it. reexec_on_failure() has called mworker_reexec() and the master process has been reexecuted. With the new architecture in such cases there is no longer need to reexecute the master process after its reload again. It simply keeps the previous worker, forked before the reload, and it lets the new one to exit with an error. But we still need the code, which increments the number of failed reloads and which notifies systemd with new "Reload failed!" status. So, let's reuse and adapt for this reexec_on_failure() and let's rename it to on_new_child_failure().
This commit is contained in:
parent
9b27f82da3
commit
2bb07b913d
@ -66,6 +66,7 @@ void display_version();
|
|||||||
|
|
||||||
void mworker_accept_wrapper(int fd);
|
void mworker_accept_wrapper(int fd);
|
||||||
void mworker_reload(int hardreload);
|
void mworker_reload(int hardreload);
|
||||||
|
void on_new_child_failure(void);
|
||||||
|
|
||||||
/* to be used with warned and WARN_* */
|
/* to be used with warned and WARN_* */
|
||||||
static inline int already_warned(unsigned int warning)
|
static inline int already_warned(unsigned int warning)
|
||||||
|
|||||||
@ -899,18 +899,10 @@ static void mworker_loop()
|
|||||||
/*
|
/*
|
||||||
* Reexec the process in failure mode, instead of exiting
|
* Reexec the process in failure mode, instead of exiting
|
||||||
*/
|
*/
|
||||||
void reexec_on_failure()
|
void on_new_child_failure()
|
||||||
{
|
{
|
||||||
struct mworker_proc *child;
|
struct mworker_proc *child;
|
||||||
|
|
||||||
if (!atexit_flag)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* get the info of the children in the env */
|
|
||||||
if (mworker_env_to_proc_list() < 0) {
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* increment the number of failed reloads */
|
/* increment the number of failed reloads */
|
||||||
list_for_each_entry(child, &proc_list, list) {
|
list_for_each_entry(child, &proc_list, list) {
|
||||||
child->failedreloads++;
|
child->failedreloads++;
|
||||||
@ -921,15 +913,13 @@ void reexec_on_failure()
|
|||||||
|
|
||||||
usermsgs_clr(NULL);
|
usermsgs_clr(NULL);
|
||||||
setenv("HAPROXY_LOAD_SUCCESS", "0", 1);
|
setenv("HAPROXY_LOAD_SUCCESS", "0", 1);
|
||||||
ha_warning("Loading failure!\n");
|
ha_warning("Failed to load worker!\n");
|
||||||
#if defined(USE_SYSTEMD)
|
#if defined(USE_SYSTEMD)
|
||||||
/* the sd_notify API is not able to send a reload failure signal. So
|
/* the sd_notify API is not able to send a reload failure signal. So
|
||||||
* the READY=1 signal still need to be sent */
|
* the READY=1 signal still need to be sent */
|
||||||
if (global.tune.options & GTUNE_USE_SYSTEMD)
|
if (global.tune.options & GTUNE_USE_SYSTEMD)
|
||||||
sd_notify(0, "READY=1\nSTATUS=Reload failed!\n");
|
sd_notify(0, "READY=1\nSTATUS=Reload failed!\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mworker_reexec(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user