14

For a while now when I switch between two user sessions the inactive one in some cases will stop executing GUI processes. This way I'm forced waiting for another session to load and can't do something in another one, because if I switch and return after a while it's still on the same point. The software affected includes rsync, rdiff-backup, KDE background processes, Steam launched in Openbox session (even downloading stops) and at least some games. VLC is not affected, at least it skips to needed time after I switch back, but for a moment I can see old frame and time in it's window.

What process is responsible for such behaviour? Can I reconfigure it somehow?

Update: Memory and Swap Usage

Some additional context: The irony is I suggested this exact behaviour on the old brainstorm.ubuntu.com (now defunct).

int_ua
  • 8,574
  • it is proabaly the priviliged of the gui file you need to ajust – Michael Jul 02 '15 at 19:20
  • Can you post the output of free --human and for szFile in /proc/*/status ; do awk '/VmSwap|Name/{printf $2 "\t" $3}END{ print "" }' $szFile done | sort --key 2 --numeric --reverse | head -n 20 after you've switched to the second session? – Fabby Jul 02 '15 at 22:47
  • P.S. Any way of getting Wake On Plan for trusty??? :-) – Fabby Jul 02 '15 at 23:03
  • What GUI file? Thanks, I'll try that first thing in the morning. Wake On Plan: I've made a version ready to be click-packaged but these are not installable yet: http://askubuntu.com/q/355728/20275 I'll try to do something about it on the weekend, thanks for asking :) – int_ua Jul 02 '15 at 23:27
  • 1
    @Fabby done, it doesn't look like a swap problem if that's what you implying. – int_ua Jul 03 '15 at 10:06
  • 2
    Yeah, that's what I was implying... ;-) I've tried to simulate the behaviour you're experiencing by: log on as a user, then log on as a secondary user, start a movie, [Ctrl][Alt][F7] to the first user, start a find on /, [ctrl][Alt][F8] to the second user and everything keeps on running... (though the sound of the movie is muted when switching users.) How do you test? – Fabby Jul 03 '15 at 12:08
  • 1
    @int_ua I don't know about steam specifically, but I've had games that contain specific code to be paused when switching users... I don't use KDE so I think I cannot help you any further... Sorry! – Fabby Jul 07 '15 at 20:37
  • The fact you see the old picture and time does not mean the application was paused. Applications don't draw to the screen, they draw into textures, and the compositor...well...composes them to build the whole display. What you see just means the compositor didn't bother refreshing the display while it wasn't on-screen. As for games, I don't know how this interacts with VSync, apps using VSync remain blocked? – spectras Sep 18 '17 at 00:59
  • The reason I created a new bounty is that even rsync launched in konsole is affected so I cannot switch to another user while running it. Thus, VSync looks completely irrelevant. – int_ua Sep 18 '17 at 12:11
  • How exactly are you determining that an GUI process or rsync has stopped? – Elder Geek Sep 19 '17 at 23:04
  • 1
    By both noting the output state before and after switching to another user and by an external HDD light ceasing all activity during another session being active. – int_ua Sep 20 '17 at 12:31
  • 2
    for rsync you are using verbose to print progress? have you tried without it + have you tried with sending it directly to the background rsync .... &? How about nohup rsync .... &? for GUI they must suspend because there is only one output resource and it does taken by another user session and they will pause : ) – αғsнιη Sep 29 '17 at 03:09
  • screen should work too, but is there a way to [temporarily] prevent this behavior while launching it with output? The question is about what exactly is responsible and it's not really clear yet from your comment, can you provide more details please? What resource do you mean exactly? – int_ua Sep 29 '17 at 16:19
  • 1
    Hi, OS is managing resources AFAICT. The output resource I mean your display (screen) because it's the only resource one active user can have it while if you sent rsync to run in background it's can use CPU, disk also cannot use input resources like mouse or keyboard for inactive user. – αғsнιη Sep 29 '17 at 21:45
  • Wouldn't a simpler test be to start a job that takes a couple minutes to complete, immediately switch user but do nothing, switch back in 5 minutes and see if it completed? Perhaps rsync is designed to suspend when focus is lost because disk shape might change or something. Perhaps a simple script that prints hello, increments counter, sleeps for a second and repeats would be a better test. – WinEunuuchs2Unix Oct 04 '17 at 23:47
  • Unfortunately I don't have the time to test and write a full answer for you. I do however have some ideas that may help. 1) In the case of CLI programs such as rsync launch them through a VT (CTRL-ALT-F1) so that the X display isn't involved. You could also background the process if you desire by launching it with command & For GUI programs you may be able to utilize a fake display. I hope this is useful. – Elder Geek Oct 05 '17 at 13:43

3 Answers3

1

I run into this problem too because I switch between console and graphical virtual terminals on a regular basis. Xorg by design suspends its clients during VT switches, which is why its clients seem to "freeze" when Xorg's VT is no longer active. Wayland does not, so if the programs you need to stay running in a background VT support the new display protocol, use a Wayland compositor instead of Xorg.

One way to work around this problem is to run graphical programs on a local VNC server so that they never get suspended. This is the workaround that I use the most frequently.

0

What process is responsible for such behaviour?

Display Manager (DM) is the one you are looking for. Anyone: lightdm, gdm, kdm (old kde), sddm (new kde), xdm ...

Can I reconfigure it somehow?

AFAIK, That should be that way with X server. However, I used to skip that behavior using:

  • CLI tools on another virtual console TTY
  • CLI tools as initservice

Concerning audio streams, when I started using GNU/Linux in 2006. Audio devices were managed separately from Display. Now, things changed much specially with the new integrated devices/ports like HDMI. So Pulse server should be aware of some X display events. As I remember (I will recheck this), Pulse server is run as user process.

user.dz
  • 48,105
  • Can you please prove the first point? How exactly or where in the code it does this? There are a lot of situations where CLI in TTY is not an option and downloads and backups are the real problem, audio is a minor issue. – int_ua Oct 06 '17 at 06:28
0

You can launch a screen session from the CLI with bash and inside this session you can launch the application. And now you can close this Terminal without problems and recover using screen -r command. Is more or less this:

screen bash
rsync -V xxx yyy

And you can close the CLI and return whatever you want and do:

screen -r

To confirm the job is done. I don't know if this can work with GUI apps using a command like:

nohup your-X-application &
manuti
  • 46