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

Add preexec hook to wait for accessibility #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AloisMahdal
Copy link

On some machines, accessibility framework (normally used to enable accessibility features for GUIs, but in anabot also used to access Anaconda GUI state programatically) may take long to start. This can result in anabot failing to access the accessibility framework and crashing with gi.repository.GLib.GError like this:

Traceback (most recent call last):
  File "/opt/launcher.py", line 6, in <module>
    sys.exit(anabot.launcher.main(*sys.argv))
  File "/opt/anabot/launcher.py", line 148, in main
    run_test("/var/run/anabot/final-recipe.xml", appname=app_name, children_required=min_children)
  File "/opt/anabot/runtime/run_test.py", line 27, in run_test
    import dogtail.tree # pylint: disable=import-error
  File "/opt/lib/python3.9/site-packages/dogtail/tree.py", line 1338, in <module>
    children = root.children
  File "/opt/lib/python3.9/site-packages/dogtail/tree.py", line 236, in children
    if self.parent and self.parent.roleName == 'hyper link':
gi.repository.GLib.GError: atspi_error: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken. (1)

This hook is designed to try and connect to the accessibility bus before anabot is started, and keep trying until the connection succeeds or we run out of attempts.

See the embedded comment for more details.

Copy link
Contributor

@pholica pholica left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise there should not be an issue (from functionality point of view). I'll leave the rest of the code review (styling) to someone else like @jstodola or @jikortus

On some machines, accessibility framework (normally used to enable
accessibility features for GUIs, but in anabot also used to access
Anaconda GUI state programatically) may take long to start.  This can
result in anabot failing to access the accessibility framework and
crashing with gi.repository.GLib.GError like this:

    Traceback (most recent call last):
      File "/opt/launcher.py", line 6, in <module>
        sys.exit(anabot.launcher.main(*sys.argv))
      File "/opt/anabot/launcher.py", line 148, in main
        run_test("/var/run/anabot/final-recipe.xml", appname=app_name, children_required=min_children)
      File "/opt/anabot/runtime/run_test.py", line 27, in run_test
        import dogtail.tree # pylint: disable=import-error
      File "/opt/lib/python3.9/site-packages/dogtail/tree.py", line 1338, in <module>
        children = root.children
      File "/opt/lib/python3.9/site-packages/dogtail/tree.py", line 236, in children
        if self.parent and self.parent.roleName == 'hyper link':
    gi.repository.GLib.GError: atspi_error: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken. (1)

This hook is designed to try and connect to the accessibility bus before
anabot is started, and keep trying until the connection succeeds or we
run out of attempts.

See the embedded comment for more details.
@AloisMahdal
Copy link
Author

AloisMahdal commented Jun 21, 2022

...then again @pholica, are you sure about the DISPLAY?

Now anabot crashes with this:

[anaconda root@kvm-02-guest08 ~]# journalctl -u anabot | cat
Jun 21 15:29:14 kvm-02-guest08.rhts.eng.brq.redhat.com platform-python[2276]: Could not open X display
Jun 21 15:29:14 kvm-02-guest08.rhts.eng.brq.redhat.com platform-python[2276]: AT-SPI: Couldn't connect to accessibility bus. Is at-spi-bus-launcher running?
Jun 21 15:29:14 kvm-02-guest08.rhts.eng.brq.redhat.com systemd-coredump[2298]: Process 2276 (platform-python) of user 0 dumped core.
[anaconda root@kvm-02-guest08 ~]# 

It's strange... I will try to obtain env dump from the hook.

Edit: the above is probably irrelevant and caused by something else. (I was trying to import dogtail.tree in order to catch the SearchError in /opt/launcher.py and wait so that I can look at the reserved machine -- so the above is likely caused by the dogtail import. (weirdly, even though i used the dogtail.config.config.checkForA11y = False trick..)

@AloisMahdal
Copy link
Author

Edit: the above is probably irrelevant and caused by something else.

...confirmed, after dumbing down the time.sleep injection (avoiding to import dogtail---by catching Exception, sigh..) it works normally.

So indeed: DISPLAY is already set when the hook is running.

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

Successfully merging this pull request may close these issues.

2 participants