[Twisted-Python] How to cap the buffering size of data to be sent in Protocol class

Weikai Xie xieweikai at gmail.com
Wed Sep 22 03:52:20 EDT 2010

    I have a server program which basically use a protocol.Protocol
class to send a continuous byte stream  to clients on TCP connections.
 However, I found , for whatever reason, if a client hung up and
failed to remove the data from its receiving socket buffer, then the
memory usage of the server program will go up endlessly.

    I think it is because the TCP sendQ buffer of the svr  was
building up as a result of  the other side does not remove the data
from its recvQ buffer (this guess was verified by the output of the
netstat command), which in turn results the twisted Protocol to buffer
the data submitted by upper layer via transport.write() to its
internal buffer.

    My questions is that whether there is any mechanism in Twisted
which can be used to set the maximum buffering size of the Protocol;
and whenever if this cap is reached, I can be informed to give a
chance to know the client is experiencing problem


Weikai Xie

More information about the Twisted-Python mailing list