Parcourir la source

[3407] Added more thorough work around for #3470 issue

Move signal hanlding initialization til after the
initial configuration but before calling runProcess().
Added additional call to clear the SignalSet inside
catch() block for runProcess.
Thomas Markwalder il y a 11 ans
Parent
commit
66e9e82c92
2 fichiers modifiés avec 16 ajouts et 10 suppressions
  1. 14 8
      src/bin/d2/d_controller.cc
  2. 2 2
      src/bin/d2/d_controller.h

+ 14 - 8
src/bin/d2/d_controller.cc

@@ -76,8 +76,6 @@ DControllerBase::launch(int argc, char* argv[], const bool test_mode) {
                    "Application Process initialization failed: " << ex.what());
     }
 
-    // Now that we have a proces, we can set up signal handling.
-    initSignalHandling();
 
     LOG_DEBUG(dctl_logger, DBGLVL_START_SHUT, DCTL_STANDALONE).arg(app_name_);
 
@@ -95,20 +93,28 @@ DControllerBase::launch(int argc, char* argv[], const bool test_mode) {
     // Everything is clear for launch, so start the application's
     // event loop.
     try {
+        // Now that we have a proces, we can set up signal handling.
+        initSignalHandling();
+
         runProcess();
+
+        /// @todo Once Trac #3470 is addressed this will not be necessary.
+        /// SignalSet uses statics which do not free in predicatable order.
+        if (signal_set_) {
+            signal_set_->clear();
+        }
     } catch (const std::exception& ex) {
         LOG_FATAL(dctl_logger, DCTL_PROCESS_FAILED)
                   .arg(app_name_).arg(ex.what());
+        /// @todo Once Trac #3470 is addressed this will not be necessary.
+        /// SignalSet uses statics which do not free in predicatable order.
+        if (signal_set_) {
+            signal_set_->clear();
+        }
         isc_throw (ProcessRunError,
                    "Application process event loop failed: " << ex.what());
     }
 
-    /// @todo Once Trac #3470 is addressed this will not be necessary.
-    /// SignalSet uses statics which do not free in predicatable order.
-    if (signal_set_) {
-        signal_set_->clear();
-    }
-
     // All done, so bail out.
     LOG_INFO(dctl_logger, DCTL_STOPPING).arg(app_name_);
 }

+ 2 - 2
src/bin/d2/d_controller.h

@@ -106,8 +106,8 @@ public:
     ///
     /// 1. parse command line arguments
     /// 2. instantiate and initialize the application process
-    /// 3. initialize signal handling
-    /// 4. load the configuration file
+    /// 3. load the configuration file
+    /// 4. initialize signal handling
     /// 5. start and wait on the application process event loop
     /// 6. exit to the caller
     ///