[tahoe-lafs-trac-stream] [Tahoe-LAFS] #3926: pid-file with creation-time
Tahoe-LAFS
trac at tahoe-lafs.org
Wed Sep 14 20:53:47 UTC 2022
#3926: pid-file with creation-time
-------------------------+---------------------------
Reporter: meejah | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: undecided
Component: unknown | Version: n/a
Keywords: | Launchpad Bug:
-------------------------+---------------------------
As a consumer of "pid files", there are several cases to consider:
- no PID file: nothing is running
- pid file exists:
- is there a currently running process with that PID?
- no: stale file
- yes: difficult (see below)
The case where a pid-file exists and points at a currently-running process
is "difficult". BSD and many Linux programs assume the worst and simply
exist (that is, they assume the program is the daemon in question and
don't want to run two copies).
This leaves the decision up to the user: they must decide whether the
pidfile is correct (in which case, kill the offending process) or if the
pidfile is incorrect (in which case, delete the pidfile).
If that "user" is some parent process (e.g. Gridsync), it is especially
hard. The "name" of the process can change. The "command-line" may be
different, depending how it was run (and can be changed at runtime too, I
believe).
One reliable indicator is "process start-time". Even in the case of a
recycled PID (that is, a program that _isn't_ tahoe but happens to have
the same PID) we can tell if it's "the tahoe process" (the creation-time
will match) or something else (the creation-time will be later).
So, Gridsync desires a PID-file that includes the process start-time.
Since our current `twistd.pid` file is written by Twisted machinery we
can't easily change that -- and arguably it "is an API" so adding a
timestamp breaks it.
I propose adding a new option `--process-file` which will write a file in
the node-directory called `running.process` which will include both the
PID and creation-time. (When we tackle https://tahoe-lafs.org/trac/tahoe-
lafs/ticket/3925 this file will be the _only_ PID-file).
--
Ticket URL: <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3926>
Tahoe-LAFS <https://Tahoe-LAFS.org>
secure decentralized storage
More information about the tahoe-lafs-trac-stream
mailing list