From 2d24518d9db587d70770f9ec5f94238ae4a5c31d Mon Sep 17 00:00:00 2001 From: Jaime Casanova Date: Sat, 21 Jul 2012 09:49:05 -0500 Subject: [PATCH] If master_response_timeout hasn't been set in repmgr.conf it defaults to zero, which was causing to a false positive in the failure detection logic in wait_connection_availability(). So, change that to defaults to 60s and add a check to avoid it being set to zero or negative. Problem reported and analyzed by Andrew Newman --- config.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/config.c b/config.c index c42c013b..7f5be7f4 100644 --- a/config.c +++ b/config.c @@ -41,7 +41,9 @@ parse_config(const char *config_file, t_configuration_options *options) memset(options->promote_command, 0, sizeof(options->promote_command)); memset(options->follow_command, 0, sizeof(options->follow_command)); memset(options->rsync_options, 0, sizeof(options->rsync_options)); - options->master_response_timeout = 0; + + /* if nothing has been provided defaults to 60 */ + options->master_response_timeout = 60; /* * Since some commands don't require a config file at all, not @@ -120,6 +122,13 @@ parse_config(const char *config_file, t_configuration_options *options) log_err(_("Node information is missing. Check the configuration file.\n")); exit(ERR_BAD_CONFIG); } + + if (options->master_response_timeout <= 0) + { + log_err(_("Master response timeout must be greater than zero. Check the configuration file.\n")); + exit(ERR_BAD_CONFIG); + } +} }