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
Metacity on fail reaped after timeout, fixes #4958 #682
Conversation
Bug: https://bugs.sugarlabs.org/ticket/4958 After calling metacity, the existence of the process is checked after a timeout. If the process has exited, then the defunct process is cleared using Popen.communicate() and metacity is called again.
|
Thanks. Tested. In shell.log is But not worth fixing, because you don't need to call Process on system is now embedded in a shell parent; because of your Played around with it a bit, and here's what I came up with for comparison; _METACITY_TIMEOUT = 1000
...
def _metacity_timeout_cb():
rc = _metacity_process.poll()
if rc is None:
return True
logging.warning('metacity returncode %r' % rc)
GObject.timeout_add(_METACITY_TIMEOUT, _metacity_restart_timeout_cb)
return False
def _metacity_restart_timeout_cb():
_start_metacity()
return False
def _start_metacity():
global _metacity_process
_metacity_process = subprocess.Popen(['metacity', '--no-force-fullscreen'])
GObject.timeout_add(_METACITY_TIMEOUT, _metacity_timeout_cb)
def _start_window_manager():
logging.warning('_start_window_manager')
settings = Gio.Settings.new('org.gnome.desktop.interface')
settings.set_string('cursor-theme', 'sugar')
_start_metacity()
screen = Wnck.Screen.get_default()
screen.connect('window-manager-changed', __window_manager_changed_cb)
_check_for_window_manager(screen)
def _stop_window_manager():
global _metacity_process
_metacity_process.terminate()Not finished. There's a risk of metacity being restarted during shutdown; the timeout is not cancelled in |
|
@quozl Thankyou. I have modified my previous code by adding logging and removing communicate and shell=True. The log went: |
|
No, you cannot forget it just because it began running. The event which triggered the bug was a race condition on Ubuntu 16.04 on particularly fast hardware, which led to the new version of metacity terminating. This happened several minutes after Sugar startup. It isn't necessary to use timeouts, you might instead add the subprocess as a source of events for the GObject main loop with |
Can we not simply remove the source for |
Yes, you can remove the source, but that's unrelated to delaying the restart. Not delaying the restart can cause a cyclic behaviour, a loop, if the root cause of metacity failure persists. The delay is so that the user can remain in control of the system. For example, in the past we have observed;
In both scenarios, not adding a delay would make the system uncontrollable while Sugar instantly reacts to a metacity exit by starting a new metacity instance. |
|
@quozl , Tried implementing with threading. Please review. It will now restart metacity after a 1sec delay every time it fails. |
|
I won't review a threading implementation, because I won't use threading myself, and am not practiced enough to make a review. We use the GObject event loop model in Sugar. I'm sure you can achieve the same result without using threading. |
|
I was skeptical about it and wanted to know if it is allowed. Will change it. |
|
I have removed threading and used io_add_watch instead to reap metacity. |
|
Looks clean, but I'd love to get @quozl back to look at this. He seems to know a lot about this area. |
|
Thanks, but no plans to do full review. Some questions;
Perhaps you might collapse the commits and force push. |
|
Hi @quozl and @samdroid-apps ,
I am returning
No, I found that the process when stalls does not zombie on using
I just added Once its reviewed, I would squash the commits, resolve the conflict and push. Thanks |
|
Welcome back.
No, I'm not asking about the
Good, thanks.
Yes, I see what you did, but having it 90 lines away from where it is used seems very wasteful of comprehension time for the next person to look at the source. It also does not seem likely to need to be tweaked. My preference is to use a literal or a variable which is immediately above where it is used. |
|
Alternate implementation at #733 @ManashRaja, please review? |
|
Hello. I have merged #733 , that pull requests fixes the SL bug #4958 |
Bug: https://bugs.sugarlabs.org/ticket/4958
After calling metacity, the existence of the process is
checked after a timeout. If the process has exited, then
the defunct process is cleared using Popen.communicate()
and metacity is called again.