After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 708695 - Need a way to avoid synchronous D-Bus calls when processing events
Need a way to avoid synchronous D-Bus calls when processing events
Status: RESOLVED OBSOLETE
Product: at-spi
Classification: Platform
Component: at-spi2-core
unspecified
Other Linux
: Normal normal
: ---
Assigned To: At-spi maintainer(s)
At-spi maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2013-09-24 17:09 UTC by Mike Gorse
Modified: 2021-07-05 10:44 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Mike Gorse 2013-09-24 17:09:32 UTC
In some cases, it is not a good idea to make synchronous calls within an event handler. Ie, there is a deadlock that can happen with the gnome-shell magnifier running if the user switches to the display panel in gnome-control-center, since gnome-control-center makes a synchronous D-Bus call to gnome-shell to query monitor information while gnome-shell is making a synchronous call to gnome-control-center to get information on the accessible that fired the focus event. See bug 708387.

There are patches to AT-SPI attached to bug 708387 that can serve as a starting point. They add a set of properties to events that can be used in the scope of the event handler to retrieve data as needed without needing to make a D-Bus call. However, the patches need some work. The properties sent should be more comprehensive and should probably be configurable by the AT, rather than simply hard-coding that extents will be sent with a state-changed:focused event. Additionally, a function something like this may be useful:

typedef void (*AtspiQueryCallback) (void *user_data);

void atspi_query_accessible (AtspiAccessible *obj, const gchar **properties, AtspiQueryCallback *cb, void *user_data, gboolean allow_sync, gboolean include_descendants, GError **error);

Or include_descendants should perhaps be an enum to allow querying the object only, its children, or all of its descendants. Or perhaps it is unnecessary and can be encoded in properties. Properties would be a list of strings specifying things to request, although its definition would need to be worked out. Anyway, the point would be to allow needed information to be fetched ahead of time, and in one call if possible. The callback would be called when the information is available. If allow_sync is FALSE, then, within the scope of the callback, calls that would result in a D-Bus call will instead throw an exception. This would make it possible that no synchronous D-Bus calls will be made within a given context, and processes such as gnome-shell that need to process unrelated queries from the application that AT-SPI is querying should set this to FALSE.

This could potentially help resolve a couple of other issues as well. Orca sometimes makes a large number of round-trip calls in order to fetch information, and the D-Bus libraries are not optimized for applications making heavy use of synchronous calls. For instance, every time Orca receives an event, it wants to know which toolkit generated the event. In order to determine this, it checks the accessible's attributes. In order to get the attributes, a synchronous D-Bus call is needed. It would be nice if Orca could ask applications to proactively send an accessible's attributes along with the event, so that Orca didn't need to turn around and ask for them. Also, caching in general has been an issue. In order to reduce the number of round-trip calls that need to be made, libatspi caches an object's name, states, parent, and children. The cache is only updated when state-changed, children-changed, or property-change notifications are sent. This makes it dependent on toolkits to always send notifications when things change, resulting in Orca sometimes seeing stale data, the current work-around being to call atspi_accessible_set_cache_mask to tell libatspi not to cache certain kinds of data for particular applications. In the long term, Orca might be able to request the data it needs when responding to an event, rather than relying on the pre-existing cache.
Comment 1 Magdalen Berns (irc magpie) 2013-09-29 01:44:20 UTC
How is this coming along? Is there anything in particular (e.g. javascript debugging) that I can do to help?
Comment 2 Magdalen Berns (irc magpie) 2013-09-29 01:44:23 UTC
How is this coming along? Is there anything in particular (e.g. javascript debugging) that I can do to help?
Comment 3 Colin Walters 2014-02-04 16:33:52 UTC
Hi Mike, did you forget to commit the atspi-accessible-private.h file?

http://build.gnome.org/continuous/buildmaster/builds/2014/02/04/46/build/log-at-spi2-core.txt
Comment 4 Mike Gorse 2014-02-04 18:00:44 UTC
The file is there now (thanks to API). See bug 723601.
Sorry for the trouble.
Comment 6 Magdalen Berns (irc magpie) 2014-02-04 20:39:34 UTC
(In reply to comment #5)
> Thanks.  I will revert
> https://git.gnome.org/browse/gnome-continuous/commit/?id=f7dbad16f08b50af25c60a680025beb20bfbfbbb
> then.

What does that mean for this bug?
Comment 7 Colin Walters 2014-02-05 08:59:51 UTC
(In reply to comment #6)
> (In reply to comment #5)
> > Thanks.  I will revert
> > https://git.gnome.org/browse/gnome-continuous/commit/?id=f7dbad16f08b50af25c60a680025beb20bfbfbbb
> > then.
> 
> What does that mean for this bug?

Nothing bad!  Just that the gnome-continuous builder will start tracking at-spi2-core git master again.
Comment 8 Mike Gorse 2014-02-06 15:07:35 UTC
It should be possible, with what I committed in 2.11.5, to fix bug 708387 without the set_timeout call, by calling register_full on the event listener, passing "Interfaces" and "ScreenExtents" as properties, but I haven't tested this.

I haven't closed the bug since I meant to add a function to the collection interface but still haven't done this.
Comment 9 André Klapper 2018-09-05 07:23:20 UTC
Is this ticket about at-spi2-core or about at-spi2-atk? 
Asking as this is currently under "api" which will get removed.
Comment 10 GNOME Infrastructure Team 2021-07-05 10:44:50 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a new ticket at
  https://gitlab.gnome.org/GNOME/at-spi2-core/-/issues/

Thank you for your understanding and your help.