Remove stale/conflicting pidfile #492
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR removes tahoe's "twistd.pid" in favor of using Gridsync's
Supervisorfor pidfile creation/management.On non-Windows systems, Twisted/twistd will create its own pidfile ("twistd.pid") for tahoe processes and will refuse to (re)start tahoe if the pid number in the file matches any running process, irrespective of the name of that process. Gridsync's
Supervisor, however, also creates/manages pidfiles for its processes (including on Windows!) but, unlike twistd, will include and check/verify the name of the process attached to the pid in the pidfile and determine staleness accordingly (i.e., by killing/restarting the process if the name actually corresponds to that of the process it is supposed to be managing, or by removing the pidfile if it does not). Removing "twistd.pid" (in favor of usingSupervisorpidfiles) thus 1) avoids the situation in which tahoe will refuse to (re)start because a) it terminated uncleanly previously and b) some other process has since begun using the same pid contained in that pidfile and 2) allows Windows subprocesses to be managed in a way that is more consistent with the other operating systems supported by Gridsync.