Don't exit dnsdist on an exception in maintenance #4640

Merged
merged 1 commit into from Nov 9, 2016

Projects

None yet

3 participants

@pieterlexis
Member

Short description

dnsdist would exit if an exception was thrown in the maintenance function.

This change logs every minute if the maintenance function throws an exception.

Checklist

I have:

@pieterlexis pieterlexis added the dnsdist label Oct 26, 2016
@phonedph1
Contributor

Nice! Fixes the biggest complaint in #4312

pdns/dnsdist.cc
+ (*f)();
+ secondsToWaitLog = 0;
+ }
+ catch(LuaContext::ExecutionErrorException &e) {
@rgacogne
rgacogne Oct 27, 2016 Member

Perhaps we could catch std::runtime_error, or even std::exception instead of LuaContext::ExecutionErrorException? Because otherwise we don't catch LuaContext::SyntaxErrorException nor LuaContext::WrongTypeException for example, although I'm not sure they can be raised in that context.

pdns/dnsdist.cc
+ infolog("Error during execution of maintenance function: %s", e.what());
+ secondsToWaitLog = 61;
+ }
+ --secondsToWaitLog;
@rgacogne
rgacogne Oct 27, 2016 Member

This should probably be decremented by interval instead of one, in case we decide to make the interval duration configurable.

@pieterlexis
pieterlexis Oct 27, 2016 Member

we might amend the assignment of secondsToWaitLog to that configuration setting. as the decrement then still happens every second?

@rgacogne
rgacogne Oct 27, 2016 Member

If interval is not guaranteed to be equal to 1 anymore, the decrement won't happen every second except if we alter the code to do so. This would probably be needed to keep the cache cleaning delay consistent anyhow.

@pieterlexis pieterlexis Don't exit dnsdist on an exception in maintenance
This change logs every minute if the maintenance function throws an
exception.
5f3ea71
@rgacogne rgacogne merged commit a1821a7 into PowerDNS:master Nov 9, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@pieterlexis pieterlexis deleted the pieterlexis:dnsdist-no-shutdown-on-maintenance-error branch Nov 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment