[Twisted-Python] adbapi / Postgres : LISTEN/NOTIFY and RealDictCursor

Glyph glyph at twistedmatrix.com
Thu Nov 3 18:54:11 EDT 2011


On Nov 3, 2011, at 6:18 PM, Tobias Oberstein wrote:

>      while not self.stopped:
>         if select.select([conn], [], [], self.timeout) == ([], [], []):
>            pass

Please note that on high-volume servers, this is problematic, as 'conn' may be higher than the maximum file descriptor pollable by select().  So if you've tuned everything to be smart, use a high-volume reactor like epoll, and set all your ulimits correctly, you will still get tracebacks out of this code depending on random accidents of ordering.

This part of the logic might therefore be better implemented as a IReadDescriptor/IWriteDescriptor provider (i.e. a subclass of FileDescriptor), assuming you can ask your postgres binding to give you non-blocking reads and writes.  You're certainly not the first person to make this mistake though, <http://divillo.com/> gives the same advice :).

Also this would probably make a better patch for txpostgres <https://launchpad.net/txpostgres> than for Twisted itself, since support depends on specific database bindings.

-glyph

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20111103/aa3cbe87/attachment-0001.htm 


More information about the Twisted-Python mailing list