[Twisted-Python] Help with BananaError
Hi all, I'm working on the gnome build brigade (http://build.gnome.org/) using Buildbot, which is a continuous integration tool based on Twisted. I have several Twisted services (buildbot masters) running behind a firewall (say ports 8001, 8002, mand 8003) and only one opened port for external connections (say 9000). I'm writting a small Twisted tool to allow me to use these services which port is not open directly for external connections through that opened port to other external Twisted clients (buildbot slaves): +----------------+ |server-1:8001<->| |server-2:8002<->|<->:9000<--->Internet<-->clients |server-3:8003<->| +----------------+ This tool has two parts, the client side (Mux) wraps the application protocol by adding a header that identifies the client and also the server it wants to connect. The server side (Demux) listens on the opened port (9000) for incomming messages, extracts the client header with information identifying the client and uses that information to properly redirect the wrapped message to the appropriate internal port. This tool works mostly ok, except that after some minutes working properly redirecting several dozens of messages correctly, the Demux breaks (on reception of a normal incoming message) with the following error message: exception: File "/home/master/devel/lib/python/twisted/spread/banana.py", line 176, in dataReceived raise BananaError("Security precaution: List too long.") The messages do not exceed the maximum size defined in banana.py, actually these messages are rather small, usually less than 1KB. Does anyone know what that error message means and when it happens? What might an application be doing wrong for that to happen? Attached is the code of this tool, both the Mux and the Demux, it is a very small file (~100 lines of code). Also, take into account that this was written as a protoype and it is my first TWisted program so it might be very badly designed. Thanks in advance for any feedback you can give!! Iago
On 3/13/08, Iago Toral <itoral@igalia.com> wrote:
This tool works mostly ok, except that after some minutes working properly redirecting several dozens of messages correctly, the Demux breaks (on reception of a normal incoming message) with the following error message:
TCP is not a message oriented protocol. It will not preserve message borders. dataReceived may get called with any amount of bytes from the incoming stream, not just the amount you expect. You probably want something like twisted.protocols.basic.NetstringReceiver to delimit messages for you.
participants (2)
-
Iago Toral -
Pavel Pergamenshchik