twistd doesn't daemonize on windows #27
Labels
No Label
0.2.0
0.3.0
0.4.0
0.5.0
0.5.1
0.6.0
0.6.1
0.7.0
0.8.0
0.9.0
1.0.0
1.1.0
1.10.0
1.10.1
1.10.2
1.10a2
1.11.0
1.12.0
1.12.1
1.13.0
1.14.0
1.15.0
1.15.1
1.2.0
1.3.0
1.4.1
1.5.0
1.6.0
1.6.1
1.7.0
1.7.1
1.7β
1.8.0
1.8.1
1.8.2
1.8.3
1.8β
1.9.0
1.9.0-s3branch
1.9.0a1
1.9.0a2
1.9.0b1
1.9.1
1.9.2
1.9.2a1
LeastAuthority.com automation
blocker
cannot reproduce
cloud-branch
code
code-dirnodes
code-encoding
code-frontend
code-frontend-cli
code-frontend-ftp-sftp
code-frontend-magic-folder
code-frontend-web
code-mutable
code-network
code-nodeadmin
code-peerselection
code-storage
contrib
critical
defect
dev-infrastructure
documentation
duplicate
enhancement
fixed
invalid
major
minor
n/a
normal
operational
packaging
somebody else's problem
supercritical
task
trivial
unknown
was already fixed
website
wontfix
worksforme
No Milestone
No Assignees
4 Participants
Notifications
Due Date
No due date set.
Reference: tahoe-lafs/trac-2024-07-25#27
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.
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.
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().
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.
See also Twisted ticket 2646:
http://twistedmatrix.com/trac/ticket/2646
Actually there are two long-running python.exe processes launched by running allmydata-tahoe... I haven't investigated further yet.
twistd can't find its pid file on Windowsto twistd doesn't daemonize on windowsThere is something that we are really misunderstanding here.
If you run "tahoe start" on Windows (with current trunk -- changeset: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.)
Testing trac mail Cc:.
I'm going to look at this for v0.6.2.
Because I love Windows so much.
We're focussing on an imminent v0.7.0 (see the roadmap) which hopefully has [#197 Small Distributed Mutable Files] and also a fix for [#199 bad SHA-256]. So I'm bumping less urgent tickets to v0.7.1.
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.
Rob has worked-around this by making a "tahoe run" command changeset: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.
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".
This ticket is about not forking when using native Windows Python; nothing to do with cygwin.
There hasn't been any significant activity on http://twistedmatrix.com/trac/ticket/2646 for 5 years, so Twisted probably won't fix this.
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