Bug 494298 - Speech Dispatcher Python module has race preventing BEGIN callback
Summary: Speech Dispatcher Python module has race preventing BEGIN callback
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: speech-dispatcher
Version: 12
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Hemant Goyal
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-04-06 09:33 UTC by Richard Schwarting
Modified: 2010-12-05 06:57 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-12-05 06:57:23 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Test Case (325 bytes, application/octet-stream)
2009-04-06 09:40 UTC, Richard Schwarting
no flags Details

Description Richard Schwarting 2009-04-06 09:33:08 UTC
Description of problem:

Speech Dispatcher has a Python API (available via speech-dispatcher-python) that lets you pass messages from Python to speechd for speaking.  

You can pass to the speak() method a callback, which will be called at different points, passing along a useful CallbackType, one of:
speechd.CallbackType.BEGIN
speechd.CallbackType.END
speechd.CallbackType.CANCEL

The issue is that the callback function is not being consistently called when the message begins, so code that should run when passed CallbackType.BEGIN does not.  It is called occasionally, but rarely.

The issue exists in CVS HEAD for speech-dispatcher, and is explained in the source code, in src/python/speechd/client.py in def speak(...)

-------------------------------------
        result = self._conn.send_data(text)
        if callback:
            msg_id = int(result[2][0])
            # TODO: Here we risk, that the callback arrives earlier, than we
            # add the item to `self._callbacks'.  Such a situation will lead to
            # the callback being ignored.
            self._lock.acquire()
            try:
                self._callbacks[msg_id] = (callback, event_types)
            finally:
                self._lock.release()
        return result
---------------------------------------






Version-Release number of selected component (if applicable):
speech-dispatcher-python-0.6.6-18.fc10.i386
speech-dispatcher-0.6.6-18.fc10.i386

How reproducible:
* 90% of the time; it seems that the more in-memory it is, the faster it goes, and the more times it misses the callback's msg_id in the code noted above.

Steps to Reproduce:
1. setup speech-dispatcher (there are some hurdles...)
2. run test script
3. run it a bunch more times!
  
Actual results:

[richard@yojimbo py]$ python CallbackTest.py
Done.
end


Expected results:

[richard@yojimbo py]$ python CallbackTest.py
Done.
begin
end


Additional info:

I tested this on two Fedora 10 installations and have the same result.

Also, pdb is a fun and informative debugger.

With Bonobo being deprecated in GNOME, gnome-speech will probably be deprecated in favour of something like speech-dispatcher.  Some apps rely on being able to act upon the beginning of a message.  Bad bug!

I will post a message to their mailing list.

Comment 1 Richard Schwarting 2009-04-06 09:40:29 UTC
Created attachment 338307 [details]
Test Case

Here's the test case, in python

Comment 2 Bug Zapper 2009-11-18 11:41:51 UTC
This message is a reminder that Fedora 10 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 10.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '10'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 10's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 10 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 3 Richard Schwarting 2009-11-25 10:25:16 UTC
I'm not reproducing it nearly as often now, but still have a couple times, and it doesn't seem that the relevant code has changed.

Comment 4 Bug Zapper 2010-11-04 11:22:34 UTC
This message is a reminder that Fedora 12 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 12.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '12'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 12's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 12 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 5 Bug Zapper 2010-12-05 06:57:23 UTC
Fedora 12 changed to end-of-life (EOL) status on 2010-12-02. Fedora 12 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.