-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kwin_x11 runs indefinitely because Xvnc exits too early #1712
Comments
kwin_x11's termination is not waited by startkde. Xvnc is closed by sesman after sesman detects exit of startkde. kwin_x11 runs indefinitely on getTimestamp due to the display is closed. Thus kwin_x11 cannot process exit event from event loop. Therefore, kwin_x11 will run a loop and consume a whole core of CPU. The fix adds a g_sleep(1000) to allow kwin_x11 to exit gracefully. Fix neutrinolabs#1712 kwin_x11 runs indefinitely because Xvnc exits too early
kwin_x11's termination is not waited by startkde. Xvnc is closed by sesman after sesman detects exit of startkde. kwin_x11 runs indefinitely on getTimestamp due to the display is closed. Thus kwin_x11 cannot process exit event from event loop. Therefore, kwin_x11 will run a loop and consume a whole core of CPU. The fix adds a g_sleep(1000) to allow kwin_x11 to exit gracefully. Fix neutrinolabs#1712 kwin_x11 runs indefinitely because Xvnc exits too early
Hi @ivzhh You've provided a lot of good information here. For information, the sequence of events when the session ends should be:-
The problem here very much seems to be with kwin_x11 as you've identified. This fault may exhibit itself with session managers other than XRDP. I think you should file a report with KDE in the first instance as this is likely to help the greatest number of people. I don't think making an official change to sesman is something which we should be doing to fix this. |
Thank you for the reply! Then I will work with kwin first to resolve the issue. |
KDE upstream provides an update on this problem. So in the future, Xrdp won't have this issue. |
I have a server running Fedora 33 with KDE session through Xrdp and I connect to it with RDP from Mac (Microsoft’s RDP) and another Fedora 33 (Remmina). For the past month, I noticed a symptom: if I click “logout” in KDE and RDP session ends. But kwin_x11 keeps running in getTimestamp(), occupying 100% of a core.
TL;DR: kwin_x11 still waits for message from X server but Xvnc is terminated already. kwin_x11 cannot exit event loop to process quit events.
Xrdp relies on Xrdp-sesman to launch Xvnc and start a X server. A basic process graph is as following:
xrdp-sesman waits for end of life of at least two processes: a display (Xvnc) and a window manager (startkde).
In my case, startkde is startplasma-x11.The call graph is:
startplasma-x11 calls plasma_session with QProcess and it ends execution based on unregistration of two dubs services: org.kde.ksmserver and org.kde.Shutdown.
plasma_session is more complicated, it runs the following eight jobs in sequence (refer to _second debug), kwin_x11 is one of them:
It should be KSelectionOwner::lostOwnership. My understanding is that it is triggered by exiting of X server in this case.
When I click logout in KDE, X server ends and display is closed. This should trigger KSelectionOwner::lostOwnership to end kwin_x11. However, kwin_x11 calls getTimestamp from Qt and it is a blocking call. The getTimestamp() works by sending dummy message to X server to get a timestamp. But now the X server is already dead. This blocks the main thread and thus KSelectionOwner::lostOwnership will never be processed.
I add a delay between exit of window manager and termination of Xvnc.
The text was updated successfully, but these errors were encountered: