Clean stale locks #164

Merged
merged 8 commits into from Nov 13, 2015

Conversation

Projects
None yet
3 participants
Contributor

dooferlad commented Oct 15, 2015

This is a re-submit of http://reviews.vapour.ws/r/2854/, which was backed out. I hope I have addressed all concerns. This has had plenty of testing on Windows as well as Linux.

(Review request: http://reviews.vapour.ws/r/2908/)

fslock/fslock.go
+ return true
+ }
+ var misses uint
+ for misses < 10 {
@bogdanteleaga

bogdanteleaga Nov 11, 2015

Contributor

github.com/juju/retry might be a good fit here

@dooferlad

dooferlad Nov 12, 2015

Contributor

Had a look but it isn't a great fit.

dooferlad added some commits Oct 14, 2015

Tidied up rebase.
NewLock matches the old function signature (is a wrapper around NewLockNeedsClock, which is the new function signature).
Nonce is just back to the UUID, but using string because it is nicer …
…to read.

Lock file now contains a YAML document containing the nonce, PID and message, so the message file has been removed.
Re-worked locking to be based entirely on cross-platform code:
 * Store UUID, message and creating PID in the lock file, encoded
   as YAML
 * Write an alive.<PID> and keep the timestamp fresh if you hold a lock,
   so if you find a lock you can check the PID against reportedly alive
   processes (does alive.<PID> exist and is it new) without resorting
   to syscalls.
Contributor

dooferlad commented Nov 13, 2015

$$merge$$

Contributor

jujubot commented Nov 13, 2015

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju-utils

Contributor

jujubot commented Nov 13, 2015

Build failed: Tests failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju-utils/59

Contributor

dooferlad commented Nov 13, 2015

$$merge$$

Contributor

jujubot commented Nov 13, 2015

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju-utils

jujubot added a commit that referenced this pull request Nov 13, 2015

Merge pull request #164 from dooferlad/clean-stale-locks
Clean stale locks

This is a re-submit of http://reviews.vapour.ws/r/2854/, which was backed out. I hope I have addressed all concerns. This has had plenty of testing on Windows as well as Linux.

(Review request: http://reviews.vapour.ws/r/2908/)

@jujubot jujubot merged commit abea1e3 into juju:master Nov 13, 2015

@dooferlad dooferlad deleted the dooferlad:clean-stale-locks branch Dec 2, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment