summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2022-12-09 15:19:59 +0100
committerJarek Kobus <jaroslaw.kobus@qt.io>2022-12-12 10:36:08 +0000
commit218b19fe140a450eb036a720362145898583d6ca (patch)
tree8bfb12b15de2c1249b7fb7c8a6f9755e96e9b9e3
parent2596f39823737081de445248316f7c1161994427 (diff)
downloadqt-creator-218b19fe140a450eb036a720362145898583d6ca.tar.gz
SshProcessInterface: Limit waiting for kill to finish
This is just a workaround for 9.0 and not a proper fix! It looks like sometimes kill command may freeze. Don't blocking wait for it for 30 seconds - limit this time to 2 seconds. Do the same inside SimpleTargetRunner. Pretend the process finished after 2 seconds, otherwise the SimpleTargetRunner object gets leaked and we start receiving asserts from ProcessLauncher about destructing it when still some processes are being run. Task-number: QTCREATORBUG-28072 Change-Id: I9766e7ff6f0c2abf2010686027702d30d32c4318 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: hjk <hjk@qt.io>
-rw-r--r--src/plugins/projectexplorer/runcontrol.cpp6
-rw-r--r--src/plugins/remotelinux/linuxdevice.cpp6
2 files changed, 9 insertions, 3 deletions
diff --git a/src/plugins/projectexplorer/runcontrol.cpp b/src/plugins/projectexplorer/runcontrol.cpp
index 0f24f23890..162ce90b45 100644
--- a/src/plugins/projectexplorer/runcontrol.cpp
+++ b/src/plugins/projectexplorer/runcontrol.cpp
@@ -1320,7 +1320,11 @@ void SimpleTargetRunnerPrivate::stop()
switch (m_state) {
case Run:
m_process.stop();
- m_process.waitForFinished();
+ if (!m_process.waitForFinished(2000)) { // TODO: it may freeze on some devices
+ QTC_CHECK(false); // Shouldn't happen, just emergency handling
+ m_process.close();
+ forwardDone();
+ }
break;
case Inactive:
break;
diff --git a/src/plugins/remotelinux/linuxdevice.cpp b/src/plugins/remotelinux/linuxdevice.cpp
index 84e0547acb..9c8a884cc5 100644
--- a/src/plugins/remotelinux/linuxdevice.cpp
+++ b/src/plugins/remotelinux/linuxdevice.cpp
@@ -492,8 +492,10 @@ bool SshProcessInterface::runInShell(const CommandLine &command, const QByteArra
process.setCommand(cmd);
process.setWriteData(data);
process.start();
- QTC_CHECK(process.waitForFinished()); // otherwise we may start producing killers for killers
- return process.exitCode() == 0;
+ bool isFinished = process.waitForFinished(2000); // TODO: it may freeze on some devices
+ // otherwise we may start producing killers for killers
+ QTC_CHECK(isFinished);
+ return isFinished;
}
void SshProcessInterface::start()