"tahoe start" emits an error message when tahoe is already running #2149
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#2149
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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?
In #2146, joeyh reports that there is a problem with git-annex's use of tahoe-lafs, which is that when git-annex invokes
tahoe start
, then if the tahoe process is already running,tahoe start
emits some error messages on stderr:git-annex doesn't want to ignore messages sent to stderr, so instead it would like for
tahoe start
not to complain about an already-started process.I propose that if a process is already running then
tahoe start
should emit a non-error (i.e. non-complainy-sounding) message, on stdout instead of on stderr, saying something like "Note: a tahoe process linked to the node directory was already running, so doing nothing.".joeyh: would this be satisfactory for git-annex's purposes?
This strikes me as messing up normal behavior to accomodate a broken caller. starting a process (of which there can be only one) when it is already running is actually an error. So there could be a "ensure-running" command that does start if it isn't running, and git-annex could use that. Or there could be some "status" command that returns 0 if tahoe is running and 1 if not, and git-annex could do that and start if necessary.
Replying to gdt:
I disagree. There is no requirement for the caller to refrain from calling
tahoe start
when the process is already running. The recommended way to ensure that a process is running is to calltahoe start
. Why should it be otherwise?The point of start when started being an error is to allow detecting incorrect assumptions. I expected this behavior because most other things behave this way - starting daemons by hand, and NetBSD's /etc/rc.d system, in which start and stop are errors if the program is or is not running. So I propose ensure-start and ensure-stop, which are non-erroring versions of start and stop, and which do not output anything if there is nothing to be done, and which do not write to stderr if there is no error.
Okay, I guess I consider "do things like other similar daemons do" to be a pretty good reason. However, I must say I have no often observed cases where writing an error message and setting an exit code when you find the thing running was helpful.
I cannot think of any case that I can recall where that information was useful to a caller. "Start if it is not already running" is what I think most users want, and "Start if it is not already running, and give me an error message if it was already running" is not something I've seen used in practice.
I guess that would be useful for situations where it was important to the caller that the thing was previously not-running — so important that the caller needs to do something about it. Do what? Kill the running process? Call a human for help? If it finds out that the process was already running. When would you want to do that about a tahoe-lafs process?
Now, I do think it can be useful if the caller is a human using the command-line, to get a visual indicator of whether the process was just started in response to my manual entry of
tahoe start
or was already running. But for me as a human operator, neither of those things is an error, and they should be displayed on stdout as normal messages like "Started…" or "Already running…", and the exit code should be set to indicate success in both cases.This is one of two issues blocking the git-annex↔LAFS integration, as mentioned here: http://source.git-annex.branchable.com/?p=source.git;a=commitdiff;h=85272d8a988b249d755ac3f8133e2bf8126fb271 . The other is #2147.
tahoe start info message on stdout would be ok, especially if --quiet suppressed it
ensure-start would also be ok
Shouldn't git annex be running
tahoe restart
, nottahoe start
? It is correct fortahoe start
to give an error if already running, and fortahoe restart
to succeed whether or not Tahoe was already running.tahoe restart bounces the server. I don't want git-annex to do that every time it tries to access it. I just want git-annex to start the server if it's not already running.
This doesn't technically block the git-annex integration. git-annex works fine, it just scares users with this ugly message every time it tries to use tahoe.
Replying to joeyh:
You're right, so we should add
tahoe --quiet start
. (-q
/--quiet
is already a global option, so it goes before the command name.)Note that it is actually
twistd
that is emitting the error message. We can redirect stderr before passing control totwistd.run()
, but that would redirect all error messages, not just the "Another twistd server is running" one.... and there isn't any "don't complain if already running" option to
twistd
.I opened a ticket for Twisted: https://twistedmatrix.com/trac/ticket/7146
Milestone renamed
renaming milestone
In 04b34b6/trunk:
"tahoe start" is now deprecated.