#27 closed defect (wontfix)

twistd doesn't daemonize on windows

Reported by: zooko Owned by: nobody
Priority: major Milestone: eventually
Component: code-nodeadmin Version: 0.7.0
Keywords: windows twisted docs Cc: zooko
Launchpad Bug:

Description (last modified by exarkun)

On Windows, Twistd doesn't write pid file (as per Twisted #2646), nor does the call to twistd exit so that you get your shell back. But it does start not one but two "python.exe" processes, which will continue running if you C-c the call to twistd and get your shell back.

To close this ticket, fix it so that twistd works the same on Windows as on all other operating systems that we support, or at least figure out what the heck is going on and document it.

Change History (24)

comment:1 Changed at 2007-05-27T14:53:53Z by zooko

  • Owner changed from somebody to zooko
  • Status changed from new to assigned

comment:2 Changed at 2007-08-20T17:50:18Z by zooko

In fact, it doesn't seem to launch a separate process at all on Windows or Cygwin -- it just keeps running and sending logging to stdout.

This is a ticket general to Twisted. It would probably make sense to submit a bug report at http://twistedmatrix.com . It might be fun for Allmydata, Inc. to fund a bug bounty program for tickets like these which are important to us but which lie outside of our code base proper.

comment:3 Changed at 2007-08-20T17:50:24Z by zooko

  • Milestone set to 0.6.0

comment:4 Changed at 2007-09-04T16:05:03Z by warner

it might make sense for our /usr/bin/allmydata-tahoe tool to offer a 'run' command instead of start/stop, since the cygwin form doesn't fork().

comment:5 Changed at 2007-09-19T03:40:20Z by warner

I've confirmed that the cygwin form does indeed fork. I'm still seeing some test problems, but I think in general cygwin should behave posixly-enough to use 'tahoe start' as usual.

The native windows form probably can't, though.

comment:6 Changed at 2007-09-19T22:54:24Z by zooko

See also Twisted ticket 2646:

http://twistedmatrix.com/trac/ticket/2646

comment:7 Changed at 2007-09-20T16:03:38Z by zooko

  • Milestone changed from 0.6.0 to 0.6.1

comment:8 Changed at 2007-09-24T02:19:30Z by zooko

Actually there *are* two long-running python.exe processes launched by running allmydata-tahoe... I haven't investigated further yet.

comment:9 Changed at 2007-09-25T18:44:50Z by zooko

  • Summary changed from twistd can't find its pid file on Windows to twistd doesn't daemonize on windows

comment:10 Changed at 2007-10-01T19:35:20Z by zooko

  • Description modified (diff)
  • Milestone changed from 0.6.1 to undecided

comment:11 Changed at 2007-10-13T22:35:14Z by zooko

  • Component changed from code to code-nodeadmin
  • Milestone changed from undecided to 0.7.0
  • Version set to 0.6.0

There is something that we are really misunderstanding here.

If you run "tahoe start" on Windows (with current trunk -- af0edec753033339), then the command-line (in my case bash in rxvt windows, but don't let that trick you into thinking that this is a cygwin version of Python, or of any of the libraries) hangs and waits, and two python.exe processes start.

If you then hit C-c you get your bash prompt back, but the two processes continue to run, and the tahoe node continues to log things to twistd.log and to be work when you connect to it with your web browesr.

Unfortunately we can't use "tahoe stop" to kill them, because they didn't write their pids, because of twisted #2646.

(Also perhaps because "tahoe stop" doesn't know how to kill processes on Windows.)

comment:12 Changed at 2007-10-17T04:39:02Z by zooko

  • Cc zooko added

Testing trac mail Cc:.

comment:13 Changed at 2007-10-19T23:08:06Z by zooko

  • Milestone changed from 0.7.0 to 0.6.2
  • Version changed from 0.6.0 to 0.6.1

I'm going to look at this for v0.6.2.

comment:14 Changed at 2007-10-19T23:08:14Z by zooko

Because I love Windows so much.

comment:15 Changed at 2007-10-22T23:33:53Z by zooko

  • Description modified (diff)

comment:16 Changed at 2007-11-01T17:14:18Z by zooko

  • Milestone changed from 0.6.2 to 0.7.1

We're focussing on an imminent v0.7.0 (see the roadmap) which hopefully has Small Distributed Mutable Files and also a fix for bad SHA-256. So I'm bumping less urgent tickets to v0.7.1.

comment:17 Changed at 2007-11-13T18:21:52Z by zooko

  • Milestone changed from 0.7.1 to 0.7.2
  • Version changed from 0.6.1 to 0.7.0

We need to choose a manageable subset of desired improvements for v0.7.1, scheduled for two week hence, so I'm bumping this one into v0.7.2, scheduled for mid-December.

comment:18 Changed at 2008-01-23T03:26:36Z by zooko

  • Milestone changed from 0.7.2 to undecided

Rob has worked-around this by making a "tahoe run" command 9ed5533760d959b6 which runs the node in the calling process and by making "start" optional and not enabled by default on Windows.

It would still be nice if Twisted would abstract this kind of thing for us so that we didn't have to know what operating system we were on when we use twistd.

comment:19 Changed at 2008-02-09T20:17:39Z by zooko

See also http://twistedmatrix.com/trac/ticket/102 -- "Support running Twisted code as NT services on Win32." -- and the latest comments on http://twistedmatrix.com/trac/ticket/2646 -- "twistd should write a pidfile on win32".

comment:20 Changed at 2009-01-09T17:37:03Z by zooko

  • Owner changed from zooko to nobody
  • Status changed from assigned to new

comment:21 Changed at 2009-12-13T04:00:01Z by davidsarah

  • Keywords windows cygwin twisted docs added

comment:22 Changed at 2010-07-15T00:39:25Z by davidsarah

  • Keywords cygwin removed

This ticket is about not forking when using native Windows Python; nothing to do with cygwin.

comment:23 Changed at 2012-11-22T00:49:10Z by davidsarah

There hasn't been any significant activity on http://twistedmatrix.com/trac/ticket/2646 for 5 years, so Twisted probably won't fix this.

comment:24 Changed at 2020-01-16T19:31:10Z by exarkun

  • Description modified (diff)
  • Resolution set to wontfix
  • Status changed from new to closed

Daemonization in the "tahoe" script is now deprecated and will probably be removed after the next release.

https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3273

Note: See TracTickets for help on using tickets.