On 05:44 pm, exarkun@divmod.com wrote:
>On Thu, 24 May 2007 18:04:57 +0200, Terry Jones <terry@jon.es> wrote:
>>>>>>>"JP" == Jean-Paul Calderone <exarkun@divmod.com> writes:
>>JP> A completely wild guess is that forking is confusing PyLucene in a
>>JP> fatal way.  Are you importing PyLucene in the .tac file itself?  If so,
>>JP> it may help to avoid doing this, so that no code from PyLucene even
>>JP> gets a chance to run until after the process has already daemonized.
>>
>>Hi JP. Thanks for the suggestion.
>>
>>Yes, the PyLucene import does happen as a result of an import in the .tac
>>file. I just made some changes to delay the import until PyLucene is
>>actually needed. That didn't work, and nor did further hiding the import by
>>using __import__.
>>
>>Is it right that all the -n switch to twistd does is prevent the fork?
>
>It does a couple other minor things, like changing the default logging to
>go to stdout instead of twistd.log, but preventing the fork is the only big
>thing, yes.

The fork does some other things though, and it's hard to say which one is affecting the execution of your program, especially since PyLucene is doing a bunch of things at the machine-code level which are highly surprising to Python programmers.

Have you tried running 'strace' on this process yet?