From: Stephen Morris Date: Thu, 31 Mar 2016 20:29:59 +0000 (+0100) Subject: [4293] Get rid of DHCPSRV_MEMFILE_LFC_UNREGISTER_TIMER_FAILED error message during... X-Git-Tag: trac4106_update_base~53^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bb60a92508662cd714e8b3de2fb60d1baa2ac236;p=thirdparty%2Fkea.git [4293] Get rid of DHCPSRV_MEMFILE_LFC_UNREGISTER_TIMER_FAILED error message during shutdown The message may have multiple causes, a shutdown being one of them. As the condition leading to the message is benign, the message has been made a debug message. --- diff --git a/src/lib/dhcpsrv/dhcpsrv_messages.mes b/src/lib/dhcpsrv/dhcpsrv_messages.mes index 306dde144a..50c26e40d7 100644 --- a/src/lib/dhcpsrv/dhcpsrv_messages.mes +++ b/src/lib/dhcpsrv/dhcpsrv_messages.mes @@ -1,4 +1,4 @@ -# 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 # 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 starts the periodic Lease File Cleanup. % DHCPSRV_MEMFILE_LFC_UNREGISTER_TIMER_FAILED failed to unregister timer 'memfile-lfc': %1 -This error message is logged when Memfile backend fails to unregister -timer used for lease file cleanup scheduling. This is highly unlikely -and indicates programming error. The message include the reason for this -error. +This debug message is logged when Memfile backend fails to unregister +timer used for lease file cleanup scheduling. There are several reasons +why this could occur, although the most likely cause is that the system +is being shut down and some other component has unregistered time timer. +The message includes the reason for this error. % 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 diff --git a/src/lib/dhcpsrv/memfile_lease_mgr.cc b/src/lib/dhcpsrv/memfile_lease_mgr.cc index 4695d53a5c..51314b4cd8 100755 --- a/src/lib/dhcpsrv/memfile_lease_mgr.cc +++ b/src/lib/dhcpsrv/memfile_lease_mgr.cc @@ -128,23 +128,29 @@ LFCSetup::LFCSetup(asiolink::IntervalTimer::Callback callback) LFCSetup::~LFCSetup() { try { // If we're here it means that either the process is terminating - // or we're reconfiguring the server. In the latter case the - // thread has been stopped probably, but we need to handle the - // former case so we call stopThread explicitly here. + // or we're reconfiguring the server. In both cases the thread has + // probably been stopped already, but we make sure by calling + // stopThread explicitly here. 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 - // must have been registered or such registration have been - // attempted. The registration may fail if the duplicate timer - // exists or if the TimerMgr's worker thread is running but if - // this happens it is a programming error. In any case, we - // don't want exceptions being thrown from the destructor so - // we just log an error here. + + // Remove the timer. This will throw an exception if the timer does not + // exist. There are several possible reasons for this: + // a) It hasn't been registered (although if the LFC Setup instance + // exists it means that the timer must have been registered or that + // such registration has been attempted). + // b) The registration may fail if the duplicate timer exists or if the + // 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"); } catch (const std::exception& ex) { - LOG_ERROR(dhcpsrv_logger, DHCPSRV_MEMFILE_LFC_UNREGISTER_TIMER_FAILED) - .arg(ex.what()); + // We don't want exceptions being thrown from the destructor so we just + // 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()); } }