[Twisted-Python] PB waitingForAnswers KeyError

Bob Ippolito bob at redivi.com
Fri Jul 22 15:19:50 EDT 2005


On Jul 22, 2005, at 4:56 AM, William Waites wrote:

> This is with the Twisted Sumo tar, with threadedselectreactor  
> dropped in:
>
>           File "/usr/lib/python2.3/site-packages/twisted/internet/ 
> threadedselectreactor.py", line 252, in _doReadOrWrite
>             why = getattr(selectable, method)()
>           File "/usr/lib/python2.3/site-packages/twisted/internet/ 
> tcp.py", line 351, in doRead
>             return self.protocol.dataReceived(data)
>           File "/usr/lib/python2.3/site-packages/twisted/spread/ 
> banana.py", line 184, in dataReceived
>             gotItem(item)
>           File "/usr/lib/python2.3/site-packages/twisted/spread/ 
> banana.py", line 114, in gotItem
>             self.callExpressionReceived(item)
>           File "/usr/lib/python2.3/site-packages/twisted/spread/ 
> banana.py", line 81, in callExpressionReceived
>             self.expressionReceived(obj)
>           File "/usr/lib/python2.3/site-packages/twisted/spread/ 
> pb.py", line 561, in expressionReceived
>             method(*sexp[1:])
>           File "/usr/lib/python2.3/site-packages/twisted/spread/ 
> pb.py", line 919, in proto_answer
>             d = self.waitingForAnswers[requestID]
>         exceptions.KeyError: 19
>
> What am I doing to make this happen? I am using a class derived  
> from the threadedselect
> blocking demo. This implementation is attached, and has a blocking  
> run() method and
> a blocking getDeferred() method. It takes interleaved' callbacks  
> and puts them in a
> queue. The run() method takes them out of the queue in a blocking  
> way and calls them.
> getDeferred() makes a threading.Event(), causes a CB to be queued,  
> and then waits
> on the event to return the result. This way there can be many  
> threads using the blocking
> getDeferred(), and many threads that just use the normal twisted  
> stuff.

I expect that you're using TwistedManager incorrectly.  There doesn't  
appear to be anything wrong with the code you attached, but it also  
doesn't do anything on its own.  The problem is somewhere else.

-bob





More information about the Twisted-Python mailing list