We ran into an odd issue recently that feels like a bug, but I wanted to throw it out to the community to see if anyone else has seen this or has any ideas.
When we run a graphical app in xfce via X2Go and then suspend the session, the app continues to run, but significantly slower than if we remain connected. If we resume the session while the app is still running, it resumes its normal speed. This issue seems identical to bug 673 (<http://bugs.x2go.org/cgi-bin/bugreport.cgi?bug=673>), but this was closed because it was not reproducible.
The simplest way I found to reproduce this is to have gnuplot plot in a loop, so it takes a while. If I use this input file:
do for [a=1:200] { plot sin(x+a) }
It runs in a reasonable amount of time while logged into an xfce x2go session: $ time gnuplot plot.txt
real 0m6.059s user 0m1.348s sys 0m0.124s
If I use a sleep first and suspend so gnuplot runs in the suspended session, it takes much longer: $ sleep 5; time gnuplot plot.txt
real 2m24.365s user 0m1.516s sys 0m0.176s
Another way to reproduce is to run glxgears and then suspend and resume. You’ll see that while suspended, the frame rate is significantly lower, but then resumes normal speed when the session is resumed.
Here are the particulars of the server: OS: Xubuntu 14.04.3 (built this to test - we’re primarily seeing this on our Ubuntu 14.04.3 systems with xfce) x2goagent: 2:3.5.0.32-0~668~ubuntu14.04.1 x2goserver: 4.0.1.19-0~1064~ubuntu14.04.1 x2goserver-extensions: 4.0.1.19-0~1064~ubuntu14.04.1 x2goserver-xsession: 4.0.1.19-0~1064~ubuntu14.04.1
Thanks for any help you can provide. Let me know if you have questions or need any other information.
-- Matthew L. Dailey Senior Systems Engineer Thayer School of Engineering Dartmouth College
I'm wondering if this is a bug or intentional? It makes sense to me
to give more CPU time to interactive applications and lower CPU to those where there isn't someone on a terminal waiting for a response.
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- Eskimo North Linux Friendly Internet Access, Shell Accounts, and Hosting. Knowledgeable human assistance, not telephone trees or script readers. See our web site: http://www.eskimo.com/ (206) 812-0051 or (800) 246-6874.
On Fri, 14 Aug 2015, Matthew L. Dailey wrote:
On 14.08.2015 11:01 PM, Robert Dinse wrote:
True, and there's a new functionality in the yet unreleased 4.1.0.0 version of x2goserver called SuperRenicer (disabled by default) that can be used to renice suspended sessions so they run with lower priority.
Even then, though, the execution should not be slower than when attached, unless the CPU is well-loaded in the first place.
There's no functionality in 4.0.1.x that would actively slow down applications (most likely draw calls - not applications in general) when suspended.
Mihai
There are process groups in Linux that might affect scheduling depending
on whether backgrounded or not.
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- Eskimo North Linux Friendly Internet Access, Shell Accounts, and Hosting. Knowledgeable human assistance, not telephone trees or script readers. See our web site: http://www.eskimo.com/ (206) 812-0051 or (800) 246-6874.
On Sat, 15 Aug 2015, Mihai Moldovan wrote:
Thanks you both for your responses.
In the case of X2Go, as I understand it, the processes that are running within the xfce session are not backgrounded when the X2Go client suspends the session. The idea is like screen - the processes continue to run normally and produce output to the X display (or virtual tty in the case of screen) - the user is just not getting updates since they’re not connected. From the perspective of the kernel, these processes should be scheduled just like any other active process.
The actual case where this was reported was a user running an app called Fluent which models flow and plots simulation convergence after each iteration. If we run this same simulation in batch mode without the graphical output, it continues to run normally even when the X2Go session is suspended.
In our case, we’ve been using X2Go for remote access to ten headless servers since January 2013, where our faculty, staff and students can do long-running simulations using engineering apps like Matlab, Fluent, etc. We’ve never tested this specific behavior, but it seems unlikely that this has been the case for the past 2 1/2 years without others reporting it. I’m going to test reverting the nx-libs upgrade from March (revert to 3.5.0.28-0~481~ubuntu14.04.1) to see if this makes any difference.
-Matt Dailey
I tried reverting to nx-libs 3.5.0.30 and also 3.5.0.28. In both cases, the slowness while suspended was the same. So, it looks like this has been happening at least since November 2014. I’m not sure whether reverting further or reverting x2goserver to an earlier version would be helpful or not.
-Matt Dailey
On 15.08.2015 08:32 PM, Matthew L. Dailey wrote:
I tried reverting to nx-libs 3.5.0.30 and also 3.5.0.28. In both cases, the slowness while suspended was the same. So, it looks like this has been happening at least since November 2014. I’m not sure whether reverting further or reverting x2goserver to an earlier version would be helpful or not.
I'm not quite sure what to tell you.
AFAIK the changes to x2goserver weren't that huge, especially on the release branch. The nightlies differ quite substantially, but you obviously never used them.
nx-libs has generally seen some development, but I cannot remember any change to the behavior of suspended sessions.
Are you sure this problem really didn't exist for the whole time?
Besides all that, Robert is right and it might well be some behavior triggered by the OS and updates to it, so you're now going to have another variable.
Mihai
So it looks to me like this behavior is long-standing - we just never noticed it until now. To go back to early 2013 as best I could, I set up an Xubuntu 12.04 box and compiled and installed x2goserver 4.0.0.1 and nx-libs 3.5.0.19 on it. Not only is the stalling behavior still present, it seems substantially worse than on the same system with current versions of x2goserver and nx-libs. So, amongst the changes over the past 2+ years are some that actually made this better. :-)
I’m still somewhat skeptical that this is kernel/OS related. It certainly could be, but I don’t see any changes to the processes themselves when the session is suspended (they’re not re-niced, etc.). It feels like some sort of timeouts or slowdown in the X implementation. I thought perhaps it had something to do with SmartScheduler, but as far as I can tell this is disabled.
So, for now we’ll just need to make our users aware of this limitation and find other solutions if they really need to do disconnected graphical work.
Thanks to everyone for their responses and if anyone is interested in looking at this more deeply, I’m happy to help/test as needed.
-Matt Dailey
An easy solution if the command isn't interactive is to launch with
'at' or 'batch'. If it is, use screen and detach.
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- Eskimo North Linux Friendly Internet Access, Shell Accounts, and Hosting. Knowledgeable human assistance, not telephone trees or script readers. See our web site: http://www.eskimo.com/ (206) 812-0051 or (800) 246-6874.
On Mon, 17 Aug 2015, Matthew L. Dailey wrote: