Skip to content
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

Epoptes clients delay 1.5 minutes on reboot/shutdown #66

Open
fottsia opened this issue Sep 8, 2018 · 5 comments
Open

Epoptes clients delay 1.5 minutes on reboot/shutdown #66

fottsia opened this issue Sep 8, 2018 · 5 comments

Comments

@fottsia
Copy link

fottsia commented Sep 8, 2018

If I boot an LTSP client and immediately try to reboot it with epoptes, it works fine.

But if I do "lock screen" or "send a message", before logging in on the client, and any time after that I try reboot/shutdown, it delays 1.5 minute before doing so.

alkisg added a commit that referenced this issue Sep 8, 2018
@alkisg
Copy link
Member

alkisg commented Sep 8, 2018

The root epoptes-client is usually running without DBUS_SESSION_BUS_ADDRESS set in the process environment. Unfortunately, the "from gi.repository import Gtk" line from epoptes-client python-based utilities autolaunches dbus! This then causes the 1.5 minute shutdown delay issue, because systemd can't cleanly terminate the autospawned dbus process.

To reproduce the issue, boot an LTSP client, don't login, and right click->open a root terminal from epoptes. Verify that ps aux | grep dbus doesn't show a session dbus running. Then send a message to the client, or lock its screen, so that a python utility that imports Gtk runs. Then verify that dbus was autolaunched, wasting memory and blocking clean shutdown.

I've yet to find any clean solutions to this issue, so for the moment I'll be exporting a fake DBUS_SESSION_BUS_ADDRESS so that it's not autolaunched while importing Gtk.

alkisg added a commit that referenced this issue Sep 8, 2018
@alkisg
Copy link
Member

alkisg commented Sep 11, 2018

An additional thing to note here is that dbus isn't killed properly, otherwise it would waste some RAM but it wouldn't delay shutdown.
That might be happening because of this:
To prevent users from killing epoptes, we specify KillSignal=SIGQUIT in epoptes-client.service. Systemd might be sending SIGQUIT to child processes as well, and dbus might be ignoring this.
It will be cleaner if we remove KillSignal=SIGQUIT, and allow the root epoptes-client process to be killed normally with the TERM signal (while still requiring SIGQUIT for the session epoptes-client).

In the future if we use systemd for the session epoptes-client too, we might tell it to keep relaunching and completely remove the SIGQUIT requirement (and even the external socat loop).

@alkisg
Copy link
Member

alkisg commented Sep 17, 2018

Fix committed in 8361913.

@alkisg alkisg closed this as completed Sep 17, 2018
@alkisg
Copy link
Member

alkisg commented Sep 18, 2018

I'll reopen this as it needs a more brutal workaround:
For example, if an LTSP client is in the login screen, and we Execute sudo gparted in it, then this will be considered a child process of ours, it will spawn dbus, and delay 1.5 minutes on shutdown.

So setting the DBUS_SESSION_BUS_ADDRESS should probably be done in client-functions, not just in our .py scripts.

@alkisg alkisg reopened this Sep 18, 2018
alkisg added a commit that referenced this issue Sep 21, 2018
@alkisg
Copy link
Member

alkisg commented Sep 21, 2018

So setting the DBUS_SESSION_BUS_ADDRESS should probably be done in client-functions, not just in our .py scripts.

I implemented that in d42e5dd, but I'll keep this issue open until the relaunching logic is reworked and KillSignal=SIGQUIT is removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants