Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -f (force) option to auto clean stale locks #74

Merged
merged 2 commits into from
Aug 9, 2018

Conversation

greezybacon
Copy link
Collaborator

If a local lock exists and the process is no longer running (according to the contained PID) or if a remote lock exists and was created by the same (local) host and the indicated PID is no longer running, then clean up the lock files and continue.

This changes the remote locking mechanism so that the remote hostname, PID, and starting timestamp, are added to a lock file called remote in the tmp/lock folder on the remote host. This is meant to allow a client to detect if it is the client owning the lock file and allows it to determine if the PID which created the lock file is still running.

If two clients have the same hostname, it could be possible for them to clobber each other with the -f option. It's up to the administrator to make sure all connecting clients have different hostnames when using this new options.

A new exit status is created, 6 which indicates that the remote lock file is owned by this host and is considered stale. The 1 status is reused if it can be detected that this host is currently syncing to the host in a different PID. The 3 status is reused to indicate that another client is syncing with this remote. If the remote lock file is stale because another client crashed, then that client would have to remove the lock or it would have to be manually removed.

If a local lock exists and the process is no longer running (according to the
contained PID) or if a remote lock exists and was created by the same (local)
host and the indicated PID is no longer running, then clean up the lock files
and continue.

This changes the remote locking mechanism so that the remote hostname, PID, and
starting timestamp, are added to a lock file called `remote` in the tmp/lock
folder on the remote host. This is meant to allow a client to detect if it is
the client owning the lock file and allows it to determine if the PID which
created the lock file is still running.

If two clients have the same hostname, it could be possible for them to clobber
each other with the `-f` option. It's up to the administrator to make sure all
connecting clients have different hostnames when using this new options.

A new exit status is created, `6` which indicates that the remote lock file is
owned by this host and is considered stale. The `1` status is reused if it can
be detected that this host is currently syncing to the host in a different PID.
The `3` status is reused to indicate that another client is syncing with this
remote. If the remote lock file is stale because another client crashed, then
that client would have to remove the lock or it would have to be manually
removed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant