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>
This commit is contained in:
Jarek Kobus
2022-12-09 15:19:59 +01:00
parent 2596f39823
commit 218b19fe14
2 changed files with 9 additions and 3 deletions

View File

@@ -1320,7 +1320,11 @@ void SimpleTargetRunnerPrivate::stop()
switch (m_state) { switch (m_state) {
case Run: case Run:
m_process.stop(); 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; break;
case Inactive: case Inactive:
break; break;

View File

@@ -492,8 +492,10 @@ bool SshProcessInterface::runInShell(const CommandLine &command, const QByteArra
process.setCommand(cmd); process.setCommand(cmd);
process.setWriteData(data); process.setWriteData(data);
process.start(); process.start();
QTC_CHECK(process.waitForFinished()); // otherwise we may start producing killers for killers bool isFinished = process.waitForFinished(2000); // TODO: it may freeze on some devices
return process.exitCode() == 0; // otherwise we may start producing killers for killers
QTC_CHECK(isFinished);
return isFinished;
} }
void SshProcessInterface::start() void SshProcessInterface::start()