Browse Source

Always stop child watch when we see process status change

Even if we are still waiting for the exec status via the status pipe, we
need to stop the watch so that it can be re-used.
Davin McCall 2 years ago
parent
commit
4baab3958f
1 changed files with 4 additions and 4 deletions
  1. 4 4
      src/proc-service.cc

+ 4 - 4
src/proc-service.cc

@@ -162,16 +162,16 @@ dasynq::rearm service_child_watcher::status_change(eventloop_t &loop, pid_t chil
     // Probably, the child died because we asked it to (sr->service_state == STOPPING). But even if we
     // didn't, there's not much we can do.
 
+    // Must stop watch now since handle_exit_status might result in re-launch:
+    // (stop_watch instead of deregister, so that we hold watch reservation).
+    stop_watch(loop);
+
     if (sr->waiting_for_execstat) {
         // We still don't have an exec() status from the forked child, wait for that
         // before doing any further processing.
         return dasynq::rearm::NOOP; // hold watch reservation
     }
 
-    // Must stop watch now since handle_exit_status might result in re-launch:
-    // (stop_watch instead of deregister, so that we hold watch reservation).
-    stop_watch(loop);
-
     if (sr->waiting_stopstart_timer) {
         sr->process_timer.stop_timer(loop);
         sr->waiting_stopstart_timer = false;