Commit c893e333 authored by Roman Gilg's avatar Roman Gilg

Populate Greeter process exit stderr

Summary:
Give more info in debug output when and how the Greeter porcess exited and
what counter-measures are triggered to unregular exits.

Should simplify debugging.

Reviewers: #plasma, apol

Reviewed By: apol

Subscribers: davidedmundson, zzag, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D28081
parent d439d877
......@@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KQuickAddons/QtQuickSettings>
#include <QDateTime>
#include <QDebug>
#include <QCommandLineParser>
#include <QSessionManager>
......@@ -54,9 +55,12 @@ static void signalHandler(int signum)
// exit gracefully to not leave behind screensaver processes (bug#224200)
// return exit code 1 to indicate that a valid password was not entered,
// to prevent circumventing the password input by sending a SIGTERM
qDebug() << "Greeter received SIGTERM. Will exit with error.";
instance->exit(1);
break;
case SIGUSR1:
qDebug() << "Greeter received SIGUSR1. Will lock immediately.";
instance->lockImmediately();
break;
}
......@@ -73,6 +77,8 @@ int main(int argc, char* argv[])
procctl(P_PID, getpid(), PROC_TRACE_CTL, &mode);
#endif
qDebug() << "Greeter is starting up.";
KLocalizedString::setApplicationDomain("kscreenlocker_greet");
// explicitly disable input methods as it makes it impossible to unlock, see BUG 306932
......
......@@ -213,33 +213,59 @@ void KSldApp::initialize()
auto finishedSignal = static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished);
connect(m_lockProcess, finishedSignal, this,
[this](int exitCode, QProcess::ExitStatus exitStatus) {
qDebug() << "Greeter process exitted with status:"
<< exitStatus << "exit code:" << exitCode;
if (m_isWayland && m_waylandDisplay && m_greeterClientConnection) {
m_greeterClientConnection->destroy();
}
if ((!exitCode && exitStatus == QProcess::NormalExit) || s_graceTimeKill || s_logindExit) {
const bool regularExit = !exitCode && exitStatus == QProcess::NormalExit;
if (regularExit || s_graceTimeKill || s_logindExit) {
// unlock process finished successfully - we can remove the lock grab
if (regularExit) {
qDebug() << "Unlocking now on regular exit.";
} else if (s_graceTimeKill) {
qDebug() << "Unlocking anyway due to grace time.";
} else {
Q_ASSERT(s_logindExit);
qDebug() << "Unlocking anyway since forced through logind.";
}
s_graceTimeKill = false;
s_logindExit = false;
doUnlock();
return;
}
// failure, restart lock process
qWarning() << "Greeter process exit unregular. Restarting lock.";
m_greeterCrashedCounter++;
if (m_greeterCrashedCounter < 4) {
// Perhaps it crashed due to a graphics driver issue, force software rendering now
qDebug("Trying to lock again with software rendering (%d/4).",
m_greeterCrashedCounter);
setForceSoftwareRendering(true);
startLockProcess(EstablishLock::Immediate);
} else if (m_lockWindow) {
qWarning("Everything else failed. Need to put Greeter in emergency mode.");
m_lockWindow->emergencyShow();
} else {
qCritical("Greeter process exitted and we could in no way recover from that!");
}
}
);
connect(m_lockProcess, &QProcess::errorOccurred, this,
[this](QProcess::ProcessError error) {
if (error == QProcess::FailedToStart) {
qDebug() << "Greeter Process failed to start. Trying to directly unlock again.";
doUnlock();
m_waylandServer->stop();
qCritical() << "Greeter Process not available";
} else {
qWarning() << "Greeter Process encountered an unhandled error:" << error;
}
}
);
......@@ -608,6 +634,7 @@ void KSldApp::startLockProcess(EstablishLock establishLock)
// start the Wayland server
int fd = m_waylandServer->start();
if (fd == -1) {
qWarning() << "Could not start the Wayland server.";
emit m_lockProcess->errorOccurred(QProcess::FailedToStart);
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment