[Twisted-Python] Two main loops, revisited
glyph at divmod.com
glyph at divmod.com
Tue Nov 27 21:22:10 MST 2007
On 03:56 am, broehl at gmail.com wrote:
>The first is that I appear to be losing messages, which makes me wonder
>if
>Twisted isn't getting enough cycles and is somehow missing incoming
>data.
As you've explained it here, that should be impossible under any
circumstances.
Can you provide a minimal, runnable example that demonstrates what you
mean by "losing messages"?
Given Twisted's pretty awesome track record in this regard, I'd say that
it's most likely that your networking code is not dealing with different
levels of latency very well - a common error is treating a chunk sent to
dataReceived as a single message (it isn't, it's a randomly-sized chunk
of data received from the network).
>The second is that my application hangs randomly. When I call
>renderFrame()
>in a simple loop (no Twisted), everything is rock-solid.
Most likely an event handler registered on a network socket is doing
something that blocks or takes a long time to complete. That isn't
Twisted, that's your application. Tools like 'strace' can help you
figure out what's going on.
>Has anyone done anything like this before (realitime 3D application
>with
>Twisted), or am I breaking new ground here?
Twisted was originally designed for MMORPGs; its very first commercial
applications were integrated with a real-time 3D engine (a very distant
cousin of which, I believe, now powers the game Tabula Rasa). I had no
issues with it then, and I don't believe anyone who has used it more
recently has had problems like the ones you're describing.
More information about the Twisted-Python
mailing list