[Twisted-web] Different behavior of twistd with and without -n

Terry Jones terry at jon.es
Thu May 24 10:12:28 EDT 2007


I'm not sure if this belongs in Twisted Python or Twisted Web.

I have a twisted.web2 server that, among other things, makes calls to
PyLucene.  Without going into detail, I'd like to ask a general question to
see if there's a high-level explanation for what I'm seeing.

When I run twistd without -n, I can take actions in the web UI that fairly
reliably cause a call into PyLucene that stops the twistd server. I don't
know what's going on, but the server definitely dies (it no longer appears
in ps, and you can't telnet to its port).  There's nothing in the log file,
no core file (I have ulimit -c unlimited), nothing. This is on Mac OS X
10.4.9, PyLucene 2.1.0-2, Python 2.5, Twisted trunk revision 20059. When I
stick in debug prints to stderr, I can see that (usually) a call to
PyLucene.IndexWriter.optimize and (sometimes) a call to
PyLucene.IndexReader.open never returns.

The weird thing is that when I run twistd -n using the same .tac file, I
can't make the thing fall over. I can click away to my heart's content in
the application UI, and it all just works. I also tried running twistd
under pydb and the thing wouldn't crash.

While I realize there's probably something up with PyLucene, I'm wondering
if anyone can suggest why running with twistd -n is preventing the
crashing.  What else does -n do, other than (presumably) forking and
running the server in the child?

Regards,
Terry



More information about the Twisted-web mailing list