<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Nov 3, 2011, at 6:18 PM, Tobias Oberstein wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Menlo; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="font-family: monospace; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while not self.stopped:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if select.select([conn], [], [], self.timeout) == ([], [], []):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pass<br></span></span></blockquote></div><br><div>Please note that on high-volume servers, this is problematic, as 'conn' may be higher than the maximum file descriptor pollable by select(). &nbsp;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.</div><div><br></div><div>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. &nbsp;You're certainly not the first person to make this mistake though, &lt;<a href="http://divillo.com/">http://divillo.com/</a>&gt; gives the same advice :).</div><div><br></div><div>Also this would probably make a better patch for txpostgres &lt;<a href="https://launchpad.net/txpostgres">https://launchpad.net/txpostgres</a>&gt; than for Twisted itself, since support depends on specific database bindings.</div><div><br></div><div>-glyph</div><div><br></div></body></html>