]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[support8785] ISC and std exceptions in handleSignal() are now caught
authorTomek Mrugalski <tomasz@isc.org>
Mon, 17 Aug 2015 18:21:00 +0000 (20:21 +0200)
committerTomek Mrugalski <tomasz@isc.org>
Thu, 20 Aug 2015 12:57:05 +0000 (14:57 +0200)
  The calls to handleSignal() are now wrapped with catch clauses
  for both ISC and standard exceptions. This would not solve the
  underlying issue, but at least would cause the server to continue
  after the issue occurs.

src/bin/dhcp4/dhcp4_messages.mes
src/bin/dhcp4/dhcp4_srv.cc

index 915fd125a6bac8ebcd07c7710e7135178585102e..61312461176ad191f44a1ea45db8178df21c660f 100644 (file)
@@ -201,6 +201,14 @@ from a client. Server does not process empty Hostname options and therefore
 option is skipped. The argument holds the client and transaction identification
 information.
 
+% DHCP4_HANDLE_SIGNAL_EXCEPTION_ISC An ISC exception was thrown while handing signal: %1
+This error message is printed when an ISC exception was raised during signal
+processing. This likely indicates a coding error and should be reported to ISC.
+
+% DHCP4_HANDLE_SIGNAL_EXCEPTION_STD An standard exception was thrown while handing signal: %1
+This error message is printed when a standard type exception was raised during signal
+processing. This likely indicates a coding error and should be reported to ISC.
+
 % DHCP4_HOOKS_LIBS_RELOAD_FAIL reload of hooks libraries failed
 A "libreload" command was issued to reload the hooks libraries but for
 some reason the reload failed.  Other error messages issued from the
index bf3477920f88a7f062666fcf1212b7074e2884f2..b9de44a94684ce658ad19aebc9e65ce0dbf4dd61 100644 (file)
@@ -420,7 +420,23 @@ Dhcpv4Srv::run() {
         // select() function is called. If the function was called before
         // receivePacket the process could wait up to the duration of timeout
         // of select() to terminate.
-        handleSignal();
+        try {
+            handleSignal();
+        } catch (const isc::Exception& e) {
+            // ISC-derived exception occurred. The nature of this exception
+            // indicates that it originated from ISC code. If this happens,
+            // it will be easy to fix as it is in the code that is under
+            // ISC control.
+            LOG_ERROR(dhcp4_logger, DHCP4_HANDLE_SIGNAL_EXCEPTION_ISC)
+                .arg(e.what());
+        } catch (const std::exception& e) {
+            // Standard exception occurred. The nature of this exception
+            // indicates that it was caused in non-ISC code. Fixing this
+            // issue will be somewhat more difficult than the one caused
+            // by ISC code.
+            LOG_ERROR(dhcp4_logger, DHCP4_HANDLE_SIGNAL_EXCEPTION_STD)
+                .arg(e.what());
+        }
 
         // Execute ready timers for the lease database, e.g. Lease File Cleanup.
         try {