<html><body>On 11:14 am, exarkun@divmod.com wrote:<br />&gt;On Mon, 02 Jul 2007 11:04:56 +0200, Markus Schiltknecht &lt;markus@bluegap.ch&gt; <br />&gt;wrote:<br />&gt;&gt;[snip]<br />&gt;&gt;Anyway, with very simple timing measures within the twisted server itself, <br />&gt;&gt;I've figured out what was causing the delays: reactor.spawnProcess() takes <br />&gt;&gt;more than a second. &#160;I knew that fork() was expensive, but that expensive?<br />&gt;<br />&gt;This isn't normal.<br /><br />Markus, can you instrument spawnProcess and figure out which *part* of it is taking so long? &#160;Like exarkun says: this is not normal. &#160;(I wonder if we are unwittingly calling some blocking API in there? &#160;I don't think so, but...)<br /><br />&gt;&gt;What I'm doing now feels very dirty: I'm calling reactor.spawnProcess() <br />&gt;&gt;from a thread. (Yes, I'm taking care that only one thread can spawn a <br />&gt;&gt;process at any time.) At least on my Linux Dev-Box, that seems to work - <br />&gt;&gt;and resolves my issue. But... calling fork() from a thread???<br />&gt;<br />&gt;Er. &#160;That's not supported. &#160;The only Twisted API you can call from a thread<br />&gt;is reactor.callFromThread.<br /><br />In other words, this may appear to work, but if you suddenly burst into flame unexpectedly, don't blame *us*. &#160;And you probably will, eventually, if you keep doing that.<br /></body></html>