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