[orca] Add customization to check for AT-SPI2 registry crash and shutdown if detected
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Add customization to check for AT-SPI2 registry crash and shutdown if detected
- Date: Tue, 31 May 2016 04:03:54 +0000 (UTC)
commit 2dba547bcae49f25649c185498d402776a464ea5
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Mon May 30 23:49:11 2016 -0400
Add customization to check for AT-SPI2 registry crash and shutdown if detected
It appears that Orca may hang when the AT-SPI2 registry crashes. What is
triggering the registry crash needs to be figured out. In the meantime,
it's better to shutdown (and announce that we are doing so) than to hang.
Note that because this is a hack, and an in-progress one at that, polling
to verify the registry is still alive is disabled by default. It can be
enabled at the moment by adding the following lines to orca_customizations.py:
import orca.settings
orca.settings.checkForRegistryCrash = True
Note that this customization may change or go away at any time.
src/orca/orca.py | 32 ++++++++++++++++++++++++++++++++
src/orca/orca_state.py | 2 ++
src/orca/settings.py | 3 +++
3 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/orca.py b/src/orca/orca.py
index 7e3c76c..eb4ce86 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -38,6 +38,8 @@ import signal
import subprocess
import sys
+from gi.repository import GLib
+
try:
from gi.repository.Gio import Settings
a11yAppSettings = Settings(schema_id='org.gnome.desktop.a11y.applications')
@@ -686,6 +688,30 @@ def abortOnSignal(signum, frame):
% signum)
die(signum)
+def _getRegistryPIDs(uid):
+ try:
+ output = subprocess.check_output('pgrep -f at-spi2-registryd -u %s' % uid, shell=True)
+ pids = [int(p) for p in output.split()]
+ except:
+ msg = 'ERROR: Could not obtain registry PID'
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return []
+
+ msg = 'ORCA: Registry PIDs FOR user id %s: %s' % (uid, pids)
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return pids
+
+def _checkRegistry():
+ pids = _getRegistryPIDs(os.getuid())
+ if pids and orca_state.registryPID in pids:
+ return True
+
+ msg = 'FATAL: Registry PID %s is not in Registry PIDs for user %s' % (orca_state.registryPID, pids)
+ debug.println(debug.LEVEL_INFO, msg, True)
+ shutdown()
+
+ return False
+
def main(cacheValues=True):
"""The main entry point for Orca. The exit codes for Orca will
loosely be based on signals, where the exit code will be the
@@ -709,6 +735,12 @@ def main(cacheValues=True):
_settingsManager.setAccessibility(True)
init(pyatspi.Registry)
+ registryPIDs = _getRegistryPIDs(os.getuid())
+ if registryPIDs:
+ orca_state.registryPID = registryPIDs[-1]
+
+ if settings.checkForRegistryCrash:
+ GLib.timeout_add(100, _checkRegistry)
try:
message = messages.START_ORCA
diff --git a/src/orca/orca_state.py b/src/orca/orca_state.py
index bb8bd49..8cff0fb 100644
--- a/src/orca/orca_state.py
+++ b/src/orca/orca_state.py
@@ -76,3 +76,5 @@ learnModeEnabled = False
orcaOS = None
listNotificationsModeEnabled = False
+
+registryPID = None
diff --git a/src/orca/settings.py b/src/orca/settings.py
index 2b1ffc3..8d054ee 100644
--- a/src/orca/settings.py
+++ b/src/orca/settings.py
@@ -376,3 +376,6 @@ layoutMode = True
rewindAndFastForwardInSayAll = False
structNavInSayAll = False
+
+# NOTE: This is temporary and could change or vanish at any time.
+checkForRegistryCrash = False
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]