[Twisted-Python] How do I debug this network problem?

Peter Westlake peter.westlake at pobox.com
Thu Nov 13 07:40:30 MST 2014



On Thu, 13 Nov 2014, at 13:17, Glyph wrote:
>
>> On Nov 13, 2014, at 1:15 PM, Peter Westlake
>> <peter.westlake at pobox.com> wrote:
>>
>> I've had a look at the code, and got rather lost amongst the
>> interfaces and inheritance and protocols and transports. If someone
>> can help me narrow down the relevant bits of code, I can put in some
>> Python tracing.
>>
>
> I could describe all the interfaces and inheritance and protocols and
> transports, but since you don't want to puzzle out all that code,
> presumably such a description would be overly complex :).
>
> A good place to start would be to figure out if the data is getting to
> Twisted at all, which means instrumenting your Protocol.
>
> If you've done the default thing, and just done class Something(AMP):,
> this means you should override dataReceived, like so:
>
>> *from* *__future__* *import* print_function
>> *from**twisted.protocols.amp**import* AMP *class**MyAMP*(AMP,
>> object): *def* dataReceived(self, data): *print*("Got some data",
>> repr(data)) *return* super(MyAMP, self).dataReceived(data)
>
> If you're not seeing anything, that will give you an idea of whether
> your kernel is not actually delivering that data to Twisted.
>
> There are, of course, a plethora of other things that could be going
> wrong - maybe your Twisted program is stuck in some blocking function
> elsewhere and the reactor loop isn't running at all, maybe you're
> using some policy wrapper which is buffering incorrectly... but that's
> a good sanity check to start with.
>

I'm certainly not averse to understanding the code, and if you had time
to describe it, that would be very kind, thank you!

I've put in the dataReceived, and the answer box does *not* make it into
the Protocol. There are two entries in protocol._outstandingRequests:
{'2189': <Deferred...>, '2188': <Deferred...>} and the log output shows
2186, 2187, 218a, 218b, ...

Peter.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20141113/01fd6de4/attachment-0002.html>


More information about the Twisted-Python mailing list