Skip to content

[Merged by Bors] - Use OS file locks in validator client#1958

Closed
michaelsproul wants to merge 9 commits intounstablefrom
file-locks
Closed

[Merged by Bors] - Use OS file locks in validator client#1958
michaelsproul wants to merge 9 commits intounstablefrom
file-locks

Conversation

@michaelsproul
Copy link
Member

@michaelsproul michaelsproul commented Nov 24, 2020

Issue Addressed

Closes #1823

Proposed Changes

  • Use OS-level file locking for validator keystores, eliminating problems with lockfiles lingering after ungraceful shutdowns (SIGKILL, power outage). I'm using the fs2 crate because it's cross-platform (unlike file-lock), and it seems to have the most downloads on crates.io.
  • Deprecate + disable --delete-lockfiles CLI param, it's no longer necessary
  • Delete the validator_dir::Manager, as it was mostly dead code and was only used in the validator list command, which has been rewritten to read the validator definitions YAML instead.

Additional Info

Tested on:

  • Linux
  • macOS
  • Docker Linux
  • Docker macOS
  • Windows

@michaelsproul michaelsproul added work-in-progress PR is a work-in-progress A0 labels Nov 24, 2020
@michaelsproul
Copy link
Member Author

Confirmed working on macOS

@michaelsproul michaelsproul marked this pull request as ready for review November 25, 2020 05:56
@michaelsproul michaelsproul added ready-for-review The code is ready for review and removed work-in-progress PR is a work-in-progress labels Nov 25, 2020
Copy link
Contributor

@blacktemplar blacktemplar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one small comment/question, otherwise lgtm.

Copy link
Member

@pawanjay176 pawanjay176 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! just a minor question

@michaelsproul
Copy link
Member Author

Ready for merging IMO. Will test Windows support once that's closer to being supported in the rest of Lighthouse.

@michaelsproul
Copy link
Member Author

I've added a warning about existing keystores and cleaned up the ValidatorDir locks a little more.

Just planning to test under Docker (on macOS and Linux) as per @ajsutton's recommendation (thanks!) then should be good to go.

Copy link
Member

@paulhauner paulhauner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! This will make users very happy, I think.

@michaelsproul
Copy link
Member Author

OK, tested on Docker Linux and Docker macOS. Hopefully CI succeeds with that typo fixed, so...

bors r+

bors bot pushed a commit that referenced this pull request Nov 26, 2020
## Issue Addressed

Closes #1823

## Proposed Changes

* Use OS-level file locking for validator keystores, eliminating problems with lockfiles lingering after ungraceful shutdowns (`SIGKILL`, power outage). I'm using the `fs2` crate because it's cross-platform (unlike `file-lock`), and it seems to have the most downloads on crates.io.
* Deprecate + disable `--delete-lockfiles` CLI param, it's no longer necessary
* Delete the `validator_dir::Manager`, as it was mostly dead code and was only used in the `validator list` command, which has been rewritten to read the validator definitions YAML instead.

## Additional Info

Tested on:

- [x] Linux
- [x] macOS
- [x] Docker Linux
- [x] Docker macOS
- [ ] Windows
@bors
Copy link

bors bot commented Nov 26, 2020

Build failed:

@michaelsproul
Copy link
Member Author

I'm feeling optimistic about that fix:

bors r+

bors bot pushed a commit that referenced this pull request Nov 26, 2020
## Issue Addressed

Closes #1823

## Proposed Changes

* Use OS-level file locking for validator keystores, eliminating problems with lockfiles lingering after ungraceful shutdowns (`SIGKILL`, power outage). I'm using the `fs2` crate because it's cross-platform (unlike `file-lock`), and it seems to have the most downloads on crates.io.
* Deprecate + disable `--delete-lockfiles` CLI param, it's no longer necessary
* Delete the `validator_dir::Manager`, as it was mostly dead code and was only used in the `validator list` command, which has been rewritten to read the validator definitions YAML instead.

## Additional Info

Tested on:

- [x] Linux
- [x] macOS
- [x] Docker Linux
- [x] Docker macOS
- [ ] Windows
@michaelsproul
Copy link
Member Author

Cancelled the regular build to let Bors handle it

@paulhauner
Copy link
Member

a8b187b looks good to me.

@michaelsproul
Copy link
Member Author

Damn it, Bors crashed :(

{:timeout,
 {GenServer, :call,
  [
    BorsNG.GitHub,
    {:post_commit_status,
     {{:installation, 10233225}, 139952333},
     {"a8b187bb4c899dea0f56559a98e15d21bff8945d", :running,
      "Running",
      "https://app.bors.tech/repositories/26362/log#batch-111416"}},
    10000
  ]}}

Time to try again:

bors r-
bors r+

bors bot pushed a commit that referenced this pull request Nov 26, 2020
## Issue Addressed

Closes #1823

## Proposed Changes

* Use OS-level file locking for validator keystores, eliminating problems with lockfiles lingering after ungraceful shutdowns (`SIGKILL`, power outage). I'm using the `fs2` crate because it's cross-platform (unlike `file-lock`), and it seems to have the most downloads on crates.io.
* Deprecate + disable `--delete-lockfiles` CLI param, it's no longer necessary
* Delete the `validator_dir::Manager`, as it was mostly dead code and was only used in the `validator list` command, which has been rewritten to read the validator definitions YAML instead.

## Additional Info

Tested on:

- [x] Linux
- [x] macOS
- [x] Docker Linux
- [x] Docker macOS
- [ ] Windows
@bors
Copy link

bors bot commented Nov 26, 2020

@bors bors bot changed the title Use OS file locks in validator client [Merged by Bors] - Use OS file locks in validator client Nov 26, 2020
@bors bors bot closed this Nov 26, 2020
@michaelsproul michaelsproul deleted the file-locks branch December 1, 2020 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A0 ready-for-review The code is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants