[Twisted-Python] Gtk2Reactor: what are the reasons for avoiding GLib functions?

Žiga Seilnacht ziga.seilnacht at gmail.com
Tue Apr 5 08:06:47 EDT 2011


Hello,

On 5.4.2011 9:08, Jason Heeris wrote:
> I'd like to try and get to the bottom of the various problems with
> Twisted + GTK + Windows (mainly issue #4932[1], but see also issues
> #4376[2], #4862[3], #1759[4]).
>
> On issue #4376 there's a comment from Exarkun:
>
> "glib handles timeouts much less efficiently than any of the existing
> Twisted reactors. Letting glib take care of these would probably make
> the glib-based reactors unusable for applications with many timeouts."
>
> Is there a benchmark or piece of code somewhere that verifies this (or
> at least gives some sort of demonstration of "unuseable")?
>

I think that the main reason for PortableGtkReactor being used on Windows
is due to glib's IO channels limitations on Windows. You can only have 63
channels in the event loop at the same time due to g_poll's use of
MsgWaitForMultipleObject.

In addition, IO channels are quite buggy on Windows when used for sockets,
see the comment at the top of the glib/giowin32.c file in the glib source
for a list of issues. E.g. I suspect that the second problem described in:

https://bugzilla.gnome.org/show_bug.cgi?id=357674

is responsible for Twisted's ticket #3371, because a similar problem
can be seen with win32eventreactor (ticket #4950), which also uses
WSAEventSelect for socket monitoring.

Best regards,
Ziga



More information about the Twisted-Python mailing list