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 652500 - DBusException seen when Orca is running with gnome-shell mag
DBusException seen when Orca is running with gnome-shell mag
Status: RESOLVED FIXED
Product: orca
Classification: Applications
Component: magnification
3.1.x
Other All
: Normal major
: ---
Assigned To: Joseph Scheuhammer
Orca Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-06-13 20:37 UTC by Joanmarie Diggs (IRC: joanie)
Modified: 2011-06-24 21:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to make D-Bus calls asynchronous (12.96 KB, patch)
2011-06-17 18:46 UTC, Joseph Scheuhammer
accepted-commit_now Details | Review
Patch to make D-Bus calls asynchronous (19.69 KB, patch)
2011-06-24 17:13 UTC, Joseph Scheuhammer
committed Details | Review

Description Joanmarie Diggs (IRC: joanie) 2011-06-13 20:37:06 UTC
Environment:
* Kubuntu Oneiric
* GNOME 3 from the Ubuntu GNOME 3 team
* Orca from current (now gnome-3-based) master
* gnome-shell mag launched via Universal Access Settings

Step to Reproduce:
1. Press Alt+F1 and start typing.

Results:
1. Orca+gsmag fails to present the text/entry or selection changes.
2. Desktop seems to hang. But if you wait long enough it comes back.

Traceback (most recent call last):
  • File "/usr/lib/python2.7/dist-packages/orca/event_manager.py", line 236 in _dequeue
    self._processObjectEvent(event)
  • File "/usr/lib/python2.7/dist-packages/orca/event_manager.py", line 493 in _processObjectEvent
    script.processObjectEvent(event)
  • File "/usr/lib/python2.7/dist-packages/orca/script.py", line 406 in processObjectEvent
    self.listeners[key](event)
  • File "/usr/lib/python2.7/dist-packages/orca/scripts/toolkits/CALLY/script.py", line 205 in onStateChanged
    default.Script.onStateChanged(self, event)
  • File "/usr/lib/python2.7/dist-packages/orca/scripts/default.py", line 3351 in onStateChanged
    self.onFocus(event)
  • File "/usr/lib/python2.7/dist-packages/orca/scripts/default.py", line 3149 in onFocus
    orca.setLocusOfFocus(event, newFocus)
  • File "/usr/lib/python2.7/dist-packages/orca/orca.py", line 673 in setLocusOfFocus
    event, oldLocusOfFocus, orca_state.locusOfFocus)
  • File "/usr/lib/python2.7/dist-packages/orca/scripts/default.py", line 1298 in locusOfFocusChanged
    mag.magnifyAccessible(event, newLocusOfFocus)
  • File "/usr/lib/python2.7/dist-packages/orca/gsmag.py", line 262 in magnifyAccessible
    _setROICursorPush(x, y, width, height)
  • File "/usr/lib/python2.7/dist-packages/orca/gsmag.py", line 143 in _setROICursorPush
    [roiLeft, roiTop, roiRight, roiBottom] = _zoomer.getRoi()
  • File "/usr/lib/pymodules/python2.7/dbus/proxies.py", line 143 in __call__
    **keywords)
  • File "/usr/lib/pymodules/python2.7/dbus/connection.py", line 630 in call_blocking
    message, timeout)
DBusException: org.freedesktop.DBus.Error.NoReply: 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.

Comment 1 Joseph Scheuhammer 2011-06-15 20:59:32 UTC
As I said on IRC, my gut says this is because the DBus calls should be asynchronous.  Python offers both a synchronous and an asynchronous interface; and, gsmag.py uses the synchronous one.

To test that hunch, I put together a quick and dirty change, making one of the calls asynchronous, and the desktop "freeze" has vanished.

I'll flesh this out fully, next, and test it thoroughly.  Feel free to assign this bug to me, if you like.

FYI:  http://smcv.pseudorandom.co.uk/2008/11/nonblocking/ -- a warning against using python's synchronous DBus interface.
Comment 2 Joanmarie Diggs (IRC: joanie) 2011-06-15 22:13:08 UTC
Props to your gut. My gut is not worthy. ;-) And I would love to assign this bug to you. Thanks Joseph!!
Comment 3 Joseph Scheuhammer 2011-06-17 18:46:40 UTC
Created attachment 190147 [details] [review]
Patch to make D-Bus calls asynchronous

In addition to making the relevant D-Bus calls asynchronous, I noticed that the "_zoomer" was not properly configured as a D-Bus interface object (makes me wonder why this worked at all).  I fixed that too.
Comment 4 Joanmarie Diggs (IRC: joanie) 2011-06-23 01:10:54 UTC
Review of attachment 190147 [details] [review]:

Works for me. Thanks!

A few nits, some more anal-retentive than others.

+        _setROICenter(self.centerX, self.centerY);

Old habit die hard. :-P (Please drop the semicolon.)

+        rightOfROI = (self.left + self.width + self.edgeMarginX) >= (roiLeft + roiWidth)
+        aboveROI = (self.top - self.edgeMarginY)  <= roiTop
+        belowROI = (self.top + self.height + self.edgeMarginY) >= (roiTop + roiHeight)

Please wrap lines which exceed 80 chars.

+def _dbusCallbackError(funcName, error):
+    """Log D-Bus errors
+
+    Arguments:
+    - funcName: The name of the gsmag function that made the D-Bus call.
+    - error: The error that D-Bus returned.
+    """
+    logLine = funcName + ' failed: ' + str(error)
+    log.info(logLine)

log.info? Using Orca's debug utilities would be helpful.

@@ -481,7 +555,7 @@ def setMagnifierCrossHair(enabled, updateScreen=True):
     if enabled:
         size = settings.magCrossHairSize
 
-    _magnifier.setCrosswireSize(size)
+    _magnifier.setCrosswireSize(size, ignore_reply=True)
     _magSettings.set_boolean(CROSSHAIRS_SHOW_KEY, enabled)

Ok, but... If Orca is no longer going to be controlling the magnifier preferences, would it make more sense just to remove that call?
 
 def setMagnifierCrossHairClip(enabled, updateScreen=True):
@@ -495,7 +569,7 @@ def setMagnifierCrossHairClip(enabled, updateScreen=True):
     if not _initialized:
         return
 
-    _magnifier.setCrosswireClip(enabled)
+    _magnifier.setCrosswireClip(enabled, ignore_reply=True)

Ditto.
 
 def setMagnifierObjectColor(magProperty, colorSetting, updateScreen=True):
     """Sets the specified zoomer property to the specified color.
@@ -524,7 +598,8 @@ def setMagnifierObjectColor(magProperty, colorSetting, updateScreen=True):
     # Shift left 8 bits to put in alpha value.
     if magProperty == 'crosswire-color':
         crossWireColor = int(colorString, 16)
-        _magnifier.setCrosswireColor(crossWireColor & 0xffffffff)
+        _magnifier.setCrosswireColor(crossWireColor & 0xffffffff,
+                                     ignore_reply=True)

Ditto.
 
     # [[[WDW - To be implemented]]]
     else:
@@ -541,7 +616,7 @@ def setMagnifierObjectSize(magProperty, size, updateScreen=True):
 
     # [[[JS - Handle only 'crosswire-size' for now]]]
     if magProperty == 'crosswire-size':
-        _magnifier.setCrosswireSize(size)
+        _magnifier.setCrosswireSize(size, ignore_reply=True)

Ditto.
 
     # [[[WDW - To be implemented]]]
     else:
@@ -603,7 +678,7 @@ def setZoomerMagFactor(x, y, updateScreen=True):
     - y: The vertical magnification level
     - updateScreen:  Whether or not to update the screen
     """
-    _zoomer.setMagFactor(x, y)
+    _zoomer.setMagFactor(x, y, ignore_reply=True)

Ditto.

So.... If you would like to leave the setFoo calls in for now that's fine. But then I'd appreciate it if you could open a new bug and remove them. If you'd like to remove those calls now, that's cool too. Feel free to commit to the master branch after cleaning up the nits.

Thanks again and sorry for the delay in getting to this.
Comment 5 Joseph Scheuhammer 2011-06-23 13:23:48 UTC
(In reply to comment #4)
> Review of attachment 190147 [details] [review]:
> 
> Works for me. Thanks!
> 
> A few nits, some more anal-retentive than others.
> 
> +        _setROICenter(self.centerX, self.centerY);
> 
> Old habit die hard. :-P (Please drop the semicolon.)

Indeed, it is verily a compiled motor reflex of my little finger. (Will drop).

> 
> +        rightOfROI = (self.left + self.width + self.edgeMarginX) >= (roiLeft +
> roiWidth)
> +        aboveROI = (self.top - self.edgeMarginY)  <= roiTop
> +        belowROI = (self.top + self.height + self.edgeMarginY) >= (roiTop +
> roiHeight)
> 
> Please wrap lines which exceed 80 chars.

Right - o.

> 
> +def _dbusCallbackError(funcName, error):
> +    """Log D-Bus errors
> +
> +    Arguments:
> +    - funcName: The name of the gsmag function that made the D-Bus call.
> +    - error: The error that D-Bus returned.
> +    """
> +    logLine = funcName + ' failed: ' + str(error)
> +    log.info(logLine)
> 
> log.info? Using Orca's debug utilities would be helpful.

Which are?  A reference to a use elsewhere would probably suffice.  Like:  "take a look at spam.py and the eggs() function where it uses thingamambob".

> 
> @@ -481,7 +555,7 @@ def setMagnifierCrossHair(enabled, updateScreen=True):
>      if enabled:
>          size = settings.magCrossHairSize
> 
> -    _magnifier.setCrosswireSize(size)
> +    _magnifier.setCrosswireSize(size, ignore_reply=True)
>      _magSettings.set_boolean(CROSSHAIRS_SHOW_KEY, enabled)
> 
> Ok, but... If Orca is no longer going to be controlling the magnifier
> preferences, would it make more sense just to remove that call?

Yes, it would (will remove, including your other "ditto"'s).

> So.... If you would like to leave the setFoo calls in for now that's fine. But
> then I'd appreciate it if you could open a new bug and remove them. If you'd
> like to remove those calls now, that's cool too. Feel free to commit to the
> master branch after cleaning up the nits.
> 

I'd rather just do those removals now.  There aren't many.
Comment 6 Joanmarie Diggs (IRC: joanie) 2011-06-23 15:15:52 UTC
 
> Which are?  A reference to a use elsewhere would probably suffice.  Like: 
> "take a look at spam.py and the eggs() function where it uses thingamambob".

In debug.py. And gsmag.py already uses it. Grep for examples. :-) But if you have questions, lemme know. Thanks!
Comment 7 Joseph Scheuhammer 2011-06-24 17:13:59 UTC
Created attachment 190604 [details] [review]
Patch to make D-Bus calls asynchronous

New patch with your suggested fixes.

I also removed a lot of dead code that was setting magnifier preferences, since this is now handled by the control center.  I checked whether any removed functions were used elsewhere in orca (grep -R <funcName> *), and removed it only if I found no reference to it.  Also ran it in a GNOME 3 environment on Fedora 15 and did not detect (1) errors relating to dbus (this bug), nor (2) errors due to the removed code.  Still, given all the deletions, it would be great if someone took a second look to see if something is amiss.
Comment 8 Joanmarie Diggs (IRC: joanie) 2011-06-24 21:05:04 UTC
Review of attachment 190604 [details] [review]:

Looks good to me. Works nicely. And my old saved Orca prefs are no longer stomping on your magnifier's prefs. ;-) Thanks much!!
Comment 9 Joanmarie Diggs (IRC: joanie) 2011-06-24 21:11:10 UTC
Comment on attachment 190604 [details] [review]
Patch to make D-Bus calls asynchronous

http://git.gnome.org/browse/orca/commit/?id=4398c717d8253289de7af1451016d3cf89943a91
Comment 10 Joanmarie Diggs (IRC: joanie) 2011-06-24 21:18:34 UTC
< clown> one thing while I remember -- when I tested keyboard  focus tracking, all was well except FireFox.  Is this a known bug.

Joseph, I just tested in Oneiric with Firefox 5. It's working as expected for me. So.... I dunno. If you can give me more specific details and/or a debug.out indicating where the problem might be, I'll investigate further.

Thanks again!