Skip to content

Commit ca0609d

Browse files
committed
[ROBUSTNESS] Make it more robust. Make sure if any process dangles it gets killed even if the parent ends proeprly.
1 parent 20cf49e commit ca0609d

1 file changed

Lines changed: 21 additions & 20 deletions

File tree

Launcher.h

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -658,30 +658,31 @@ class Launcher : public PluginHost::IPlugin {
658658

659659
// Wait for a maximum configured wait time before we shoot the process!!
660660
_process.WaitProcessCompleted(_closeTime * 1000);
661+
}
661662

662-
// If there was a proper shutdown, all assoicated processes should have left.
663-
// If not, we will start doing it the rude way!!
664-
if (_processList.size() != 0) {
665-
_adminLock.Lock();
666-
_shutdownPhase = 2;
663+
// If there was a proper shutdown, all assoicated processes should have left.
664+
// If not, we will start doing it the rude way!!
665+
if (_processList.size() != 0) {
666+
_adminLock.Lock();
667+
_shutdownPhase = 2;
667668

668-
TRACE_L1("Trying to force kill\n");
669-
for (int i = 0; i < _processList.size(); i++) {
670-
::kill(_processList[i], SIGKILL);
671-
}
669+
TRACE_L1("Trying to force kill\n");
670+
for (int i = 0; i < _processList.size(); i++) {
671+
::kill(_processList[i], SIGKILL);
672+
}
672673

673-
_adminLock.Unlock();
674-
}
675-
676-
if (_processListEmpty.Lock(1000) != Core::ERROR_NONE) {
677-
TRACE(Trace::Fatal, (_T("Could not kill all spawned processes for: %s."), _options.Command().c_str()));
678-
_processList.clear();
679-
}
680-
_processListEmpty.Unlock();
681-
_adminLock.Lock();
682-
_shutdownPhase = 0;
683-
_adminLock.Unlock();
674+
_adminLock.Unlock();
684675
}
676+
677+
if (_processListEmpty.Lock(1000) != Core::ERROR_NONE) {
678+
TRACE(Trace::Fatal, (_T("Could not kill all spawned processes for: %s."), _options.Command().c_str()));
679+
_processList.clear();
680+
}
681+
682+
_adminLock.Lock();
683+
_processListEmpty.Unlock();
684+
_shutdownPhase = 0;
685+
_adminLock.Unlock();
685686
}
686687

687688
private:

0 commit comments

Comments
 (0)