mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 14:04:32 +00:00
watchfrr: Delay restart_kill if still reading configuration
This mostly happens only for large configuration files, where the default restart-time (-T, --restart-time / 20s) is not enough. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
This commit is contained in:
parent
eb53128367
commit
2ab760f056
@ -112,6 +112,7 @@ static struct global_state {
|
|||||||
long period;
|
long period;
|
||||||
long timeout;
|
long timeout;
|
||||||
long restart_timeout;
|
long restart_timeout;
|
||||||
|
bool reading_configuration;
|
||||||
long min_restart_interval;
|
long min_restart_interval;
|
||||||
long max_restart_interval;
|
long max_restart_interval;
|
||||||
long operational_timeout;
|
long operational_timeout;
|
||||||
@ -365,6 +366,16 @@ static void restart_kill(struct thread *t_kill)
|
|||||||
struct timeval delay;
|
struct timeval delay;
|
||||||
|
|
||||||
time_elapsed(&delay, &restart->time);
|
time_elapsed(&delay, &restart->time);
|
||||||
|
|
||||||
|
if (gs.reading_configuration) {
|
||||||
|
zlog_err(
|
||||||
|
"%s %s child process appears to still be reading configuration, delaying for another %lu time",
|
||||||
|
restart->what, restart->name, gs.restart_timeout);
|
||||||
|
thread_add_timer(master, restart_kill, restart,
|
||||||
|
gs.restart_timeout, &restart->t_kill);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
zlog_warn(
|
zlog_warn(
|
||||||
"%s %s child process %d still running after %ld seconds, sending signal %d",
|
"%s %s child process %d still running after %ld seconds, sending signal %d",
|
||||||
restart->what, restart->name, (int)restart->pid,
|
restart->what, restart->name, (int)restart->pid,
|
||||||
@ -1059,6 +1070,8 @@ void watchfrr_status(struct vty *vty)
|
|||||||
vty_out(vty, " Min Restart Interval: %ld\n", gs.min_restart_interval);
|
vty_out(vty, " Min Restart Interval: %ld\n", gs.min_restart_interval);
|
||||||
vty_out(vty, " Max Restart Interval: %ld\n", gs.max_restart_interval);
|
vty_out(vty, " Max Restart Interval: %ld\n", gs.max_restart_interval);
|
||||||
vty_out(vty, " Restart Timeout: %ld\n", gs.restart_timeout);
|
vty_out(vty, " Restart Timeout: %ld\n", gs.restart_timeout);
|
||||||
|
vty_out(vty, " Reading Configuration: %s\n",
|
||||||
|
gs.reading_configuration ? "yes" : "no");
|
||||||
if (gs.restart.pid)
|
if (gs.restart.pid)
|
||||||
vty_out(vty, " global restart running, pid %ld\n",
|
vty_out(vty, " global restart running, pid %ld\n",
|
||||||
(long)gs.restart.pid);
|
(long)gs.restart.pid);
|
||||||
@ -1264,6 +1277,16 @@ static void netns_setup(const char *nsname)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void watchfrr_start_config(void)
|
||||||
|
{
|
||||||
|
gs.reading_configuration = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void watchfrr_end_config(void)
|
||||||
|
{
|
||||||
|
gs.reading_configuration = false;
|
||||||
|
}
|
||||||
|
|
||||||
static void watchfrr_init(int argc, char **argv)
|
static void watchfrr_init(int argc, char **argv)
|
||||||
{
|
{
|
||||||
const char *special = "zebra";
|
const char *special = "zebra";
|
||||||
@ -1558,6 +1581,7 @@ int main(int argc, char **argv)
|
|||||||
master = frr_init();
|
master = frr_init();
|
||||||
watchfrr_error_init();
|
watchfrr_error_init();
|
||||||
watchfrr_init(argc, argv);
|
watchfrr_init(argc, argv);
|
||||||
|
cmd_init_config_callbacks(watchfrr_start_config, watchfrr_end_config);
|
||||||
watchfrr_vty_init();
|
watchfrr_vty_init();
|
||||||
|
|
||||||
frr_config_fork();
|
frr_config_fork();
|
||||||
|
Loading…
Reference in New Issue
Block a user