[Twisted-Python] Catching error in protocol.ReconnectingClientFactory

Martin martin at webscio.net
Thu Jun 28 06:01:37 MDT 2012


On 28/06/12 12:46, Martin wrote:
> On 26/06/12 15:12, exarkun at twistedmatrix.com wrote:
>> On 25 Jun, 12:16 pm, martin at webscio.net wrote:
>>>>
>>> No suggestions as to how I could get rid of this? :(
>>
>> I put together a minimal example of ReconnectingClientFactory for the 
>> connection refused case for you.  It's attached.  I don't see any 
>> errors logged.  If your program differs from this, please modify the 
>> example until it produces the problem. Without this, it's very 
>> unlikely that anyone will be able to determine the problem or 
>> recommend a solution.
>>
>> For future questions, if you could put together this minimal example 
>> yourself, you'll probably find you get help more quickly.
>>
>> Here's the output I see when I run the program:
>>
>> 2012-06-26 10:07:26-0400 [-] Log opened.
>> 2012-06-26 10:07:26-0400 [-] Starting factory 
>> <twisted.internet.protocol.ReconnectingClientFactory instance at 
>> 0x215ffc8>
>> 2012-06-26 10:07:26-0400 [Uninitialized] 
>> <twisted.internet.ssl.Connector instance at 0x2164128> will retry in 
>> 2 seconds
>> 2012-06-26 10:07:26-0400 [Uninitialized] Stopping factory 
>> <twisted.internet.protocol.ReconnectingClientFactory instance at 
>> 0x215ffc8>
>> 2012-06-26 10:07:28-0400 [-] Starting factory 
>> <twisted.internet.protocol.ReconnectingClientFactory instance at 
>> 0x215ffc8>
>> 2012-06-26 10:07:28-0400 [Uninitialized] 
>> <twisted.internet.ssl.Connector instance at 0x2164128> will retry in 
>> 4 seconds
>> 2012-06-26 10:07:28-0400 [Uninitialized] Stopping factory 
>> <twisted.internet.protocol.ReconnectingClientFactory instance at 
>> 0x215ffc8>
>> ^C2012-06-26 10:07:30-0400 [-] Received SIGINT, shutting down.
>> 2012-06-26 10:07:30-0400 [-] Main loop terminated.
>>
>>
>> Jean-Paul
>>
>>
>> _______________________________________________
>> Twisted-Python mailing list
>> Twisted-Python at twistedmatrix.com
>> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
> Thanks a lot for the suggestions! I tried plugging in a fake address 
> (like you did) in my code and indeed I'm not getting the deferred 
> message at the end. So apparently it only happens when a connection is 
> actually established first and then lost. I'll try to figure out a 
> minimal example where/why it starts happening (I'll probably know how 
> to fix it then too.. I just thought there'd be an easier way).
>
>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

And found it.. the ReconnectingClientFactory was using an instance of a 
LengthDelimitedStream as the protocol and that's where the deferred was 
coming from.

Sorry for all the nagging, I should have figured it out myself.. but tbh 
getting the hang of Twisted is not so easy :)

Cheers!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20120628/017e8b81/attachment.html>


More information about the Twisted-Python mailing list