[Twisted-Python] Unable to start twistd service on Ubuntu 10.04 when using pseudo terminal

Garret Heaton powdahound at gmail.com
Mon Sep 27 23:15:15 EDT 2010

To me this seems like a very strange problem and I've tried to debug it best
I can but I don't know much about many of the components at work. Here's
what happened:

I've been happily using Capistrano to deploy many twistd services to Ubuntu
9.04 machines. It restarts them via an init.d script based off this
template: http://twistedmatrix.com/trac/attachment/ticket/3434/twistdplugin.
I'm running a self-installed Twisted 8.2.0 on both systems with some small
tweaks to logging.

On newer Ubuntu 10.04 machines I've been deploying to the twistd services
don't restart properly. There are no errors in the log. The only log lines
I'd get were:
[-] Log opened.
[-] twistd 8.2.0 (/usr/bin/python 2.6.5) starting up.
[-] reactor class: twisted.internet.epollreactor.EPollReactor.

But they were only failing to restart when run via Capistrano. I realized
that the only difference was that Capistrano was using a pseudo terminal
when it issued its commands. To recreate the problem without Capistrano I
can run:
> ssh -t user at host "/etc/init.d/service start"

But it works fine when I run:
> ssh user at host "/etc/init.d/service start"

The 3 log lines I see in the failed case are written by twistd before it
forks (clone() syscall) to create the daemon process. The strace dump of
twistd when run with and without pseudo terminal were identical. I tried
running strace with the -f option to get some info about the child process
but it didn't fail in that case since I guess it doesn't actually fork.
Running in a pseudo terminal with --nodaemon passed to twistd also works

I've tested this with multiple twistd services and am having the same issue
with all of them.

Any ideas? Did I completely misdiagnose the problem? Has there been some
change in this area between Twisted 8.2.0 and 10.x? I'm certainly confused.

- Garret
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20100927/9e6867ef/attachment.htm 

More information about the Twisted-Python mailing list