Commit 06204c5d authored by Stephen Morris's avatar Stephen Morris
Browse files

[master] Merge branch 'trac4293'

parents 5adcd2c0 62b89c1a
# Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2012-2016 Internet Systems Consortium, Inc. ("ISC")
# #
# This Source Code Form is subject to the terms of the Mozilla Public # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this # License, v. 2.0. If a copy of the MPL was not distributed with this
...@@ -375,10 +375,11 @@ An informational message issued when the Memfile lease database backend ...@@ -375,10 +375,11 @@ An informational message issued when the Memfile lease database backend
starts the periodic Lease File Cleanup. starts the periodic Lease File Cleanup.
% DHCPSRV_MEMFILE_LFC_UNREGISTER_TIMER_FAILED failed to unregister timer 'memfile-lfc': %1 % DHCPSRV_MEMFILE_LFC_UNREGISTER_TIMER_FAILED failed to unregister timer 'memfile-lfc': %1
This error message is logged when Memfile backend fails to unregister This debug message is logged when Memfile backend fails to unregister
timer used for lease file cleanup scheduling. This is highly unlikely timer used for lease file cleanup scheduling. There are several reasons
and indicates programming error. The message include the reason for this why this could occur, although the most likely cause is that the system
error. is being shut down and some other component has unregistered the timer.
The message includes the reason for this error.
% DHCPSRV_MEMFILE_NEEDS_DOWNGRADING version of lease file: %1 schema is later than version %2 % DHCPSRV_MEMFILE_NEEDS_DOWNGRADING version of lease file: %1 schema is later than version %2
A warning message issued when the schema of the lease file loaded by the server A warning message issued when the schema of the lease file loaded by the server
......
...@@ -128,23 +128,29 @@ LFCSetup::LFCSetup(asiolink::IntervalTimer::Callback callback) ...@@ -128,23 +128,29 @@ LFCSetup::LFCSetup(asiolink::IntervalTimer::Callback callback)
LFCSetup::~LFCSetup() { LFCSetup::~LFCSetup() {
try { try {
// If we're here it means that either the process is terminating // If we're here it means that either the process is terminating
// or we're reconfiguring the server. In the latter case the // or we're reconfiguring the server. In both cases the thread has
// thread has been stopped probably, but we need to handle the // probably been stopped already, but we make sure by calling
// former case so we call stopThread explicitly here. // stopThread explicitly here.
timer_mgr_->stopThread(); timer_mgr_->stopThread();
// This may throw exception if the timer hasn't been registered
// but if the LFC Setup instance exists it means that the timer // Remove the timer. This will throw an exception if the timer does not
// must have been registered or such registration have been // exist. There are several possible reasons for this:
// attempted. The registration may fail if the duplicate timer // a) It hasn't been registered (although if the LFC Setup instance
// exists or if the TimerMgr's worker thread is running but if // exists it means that the timer must have been registered or that
// this happens it is a programming error. In any case, we // such registration has been attempted).
// don't want exceptions being thrown from the destructor so // b) The registration may fail if the duplicate timer exists or if the
// we just log an error here. // TimerMgr's worker thread is running but if this happens it is a
// programming error.
// c) The program is shutting down and the timer has been removed by
// another component.
timer_mgr_->unregisterTimer("memfile-lfc"); timer_mgr_->unregisterTimer("memfile-lfc");
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
LOG_ERROR(dhcpsrv_logger, DHCPSRV_MEMFILE_LFC_UNREGISTER_TIMER_FAILED) // We don't want exceptions being thrown from the destructor so we just
.arg(ex.what()); // log a message here. The message is logged at debug severity as
// we don't want an error message output during shutdown.
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE,
DHCPSRV_MEMFILE_LFC_UNREGISTER_TIMER_FAILED).arg(ex.what());
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment