What happens when reloading a broken config?


I’m currently looking into what happens if Consul is reloaded with a config file that is partially invalid. For example, what if the config contains a local script check, but enabled_local_script_checks is false?

From looking at Agent.ReloadConfig it seems like the agent would bail out with an error message, and continue operating with partial configuration instead of rolling back to the previous, known-good one. So depending on where the error occurs, some services might be de-registered, some health checks missing, etc.

Is this correct or am I missing something?

@lmb Your assessment is accurate. If the configuration isn’t valid then the agent will be left in a partially configured state.

This is definitely not ideal. I have opened a feature request for improving this.

@lmb One way to partially mitigate this issue currently is to run consul validate against the config files before the reload. If the config is invalid it will return 1.

Edit: Sorry I was mistaken, the checks run by consul validate are already run by consul reload and would not help in the scenario you provided.