summaryrefslogtreecommitdiff
path: root/src/tools/processlauncher
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2022-04-01 15:14:05 +0200
committerJarek Kobus <jaroslaw.kobus@qt.io>2022-04-12 13:59:41 +0000
commit00acccfd3d668e2936677c7ebb9914e363c700c8 (patch)
tree22ece8785d7ae455f42b49a63a8201da8ae88267 /src/tools/processlauncher
parentfea22eadb6055db1386872dd73f99f83135633b9 (diff)
downloadqt-creator-00acccfd3d668e2936677c7ebb9914e363c700c8.tar.gz
QtcProcess: Fix terminate() for process launcher
ProcessLauncherImpl::terminate() was behaving the same as ProcessLauncherImpl::kill() in case of process launcher implementation - in both cases the launcher immediately returned confirmation about receiving the close request and was putting the corresponding process into its reaper. However, the issue with this approach is that we can't receive anymore any potential ready read signal from the process being terminated after a call to terminate(). The fix is to diverge the behavior of terminate() and kill() of ProcessLauncherImpl. The behavior of kill() remains the same, while terminate() just instructs the process launcher to start termination without putting the process into the reaper, yet. Add a test that checks for any possible zombies. We run the RecursiveBlockingProcess recursively. The most nested process blocks. After a short wait we terminate the outermost process. With this test we are trying to see if terminating the middle process terminates also its children and doesn't leave zombies. Before we execute the test (and also by the end of this test) we call Singleton::deleteAll() in order to ensure that reaping of previously running processes has finished. We ensure the number of running processtestapps is zero. Later, we ensure that the leaf process was already started and the number of running processtestapps equals the depth of recursion. Fix apparent bug in getLocalProcessesUsingProc(). Change-Id: I7e2bc46ad5ca22f26620da86fbaf0fa00a7db3c3 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/tools/processlauncher')
-rw-r--r--src/tools/processlauncher/launchersockethandler.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/tools/processlauncher/launchersockethandler.cpp b/src/tools/processlauncher/launchersockethandler.cpp
index ccf7fa0950..9b64314843 100644
--- a/src/tools/processlauncher/launchersockethandler.cpp
+++ b/src/tools/processlauncher/launchersockethandler.cpp
@@ -247,6 +247,15 @@ void LauncherSocketHandler::handleStopPacket()
logDebug("Got stop request for unknown process");
return;
}
+ const auto packet = LauncherPacket::extractPacket<StopProcessPacket>(
+ m_packetParser.token(),
+ m_packetParser.packetData());
+
+ if (packet.signalType == StopProcessPacket::SignalType::Terminate) {
+ process->terminate();
+ return;
+ }
+
if (process->state() == QProcess::NotRunning) {
// This shouldn't happen, since as soon as process finishes or error occurrs
// the process is being removed.