You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by David Koblas <ko...@extra.com> on 2009/11/06 23:34:22 UTC

small bug in python TTwisted.py

To whomever might maintain the twisted/python interface.

Looks like if you make a Thrift call from an errback you end up with the 
following exception:

  File ".../thrift/transport/TTwisted.py", line 82, in connectionLost
    for k,v in self.client._reqs.iteritems():


After thinking about this, I've made my code read:

    def connectionLost(self, reason=connectionDone):
        while self.client._reqs :
            reqs = self.client._reqs
            self.client._reqs = {}
            for k,v in reqs.iteritems() :
                tex = TTransport.TTransportException(
                    type=TTransport.TTransportException.END_OF_FILE,
                    message='Connection closed')
                v.errback(tex)



Re: small bug in python TTwisted.py

Posted by David Koblas <ko...@extra.com>.
I'm not sure I can recreate the traceback anymore, the general problem 
is/was that due to another bug the client attempted to send another 
request to the Thrift service while it was shutting down 
(connectionLost).  Thus I would end up with "big" exception of the 
dictionary being modified inside the iteration. 

Struck me as easier to extract the dictionary either prior to the for 
loop or any potential fix that would iterate until the dictionary was 
empty avoiding the problem of misbehaving clients which attempt to send 
a request while shutting down.

Hopefully this makes sense,
--koblas

Esteve Fernandez wrote:
>> To whomever might maintain the twisted/python interface.
>>     
>
> I guess that's me :-)
>
>   
>> Looks like if you make a Thrift call from an errback you end up with the
>> following exception:
>>     
>
> I'm not sure what you mean, do you have a code snippet?
>
>   
>>   File ".../thrift/transport/TTwisted.py", line 82, in connectionLost
>>     for k,v in self.client._reqs.iteritems():
>>     
>
> Seems the traceback got truncated, could you send it again?
>
> Thanks for reporting the bug!
>
>   

Re: small bug in python TTwisted.py

Posted by Esteve Fernandez <es...@sindominio.net>.
> To whomever might maintain the twisted/python interface.

I guess that's me :-)

> Looks like if you make a Thrift call from an errback you end up with the
> following exception:

I'm not sure what you mean, do you have a code snippet?

>   File ".../thrift/transport/TTwisted.py", line 82, in connectionLost
>     for k,v in self.client._reqs.iteritems():

Seems the traceback got truncated, could you send it again?

Thanks for reporting the bug!