-
Notifications
You must be signed in to change notification settings - Fork 213
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
fix(iroh): do not remove the rpc lockfile if an iroh node is already running #2013
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
474da5f
to
1b0727f
Compare
dignifiedquire
approved these changes
Feb 8, 2024
flub
approved these changes
Feb 9, 2024
excellent choice |
dignifiedquire
approved these changes
Feb 9, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
much much better than what we currently have!
This was referenced Feb 16, 2024
github-merge-queue bot
pushed a commit
that referenced
this pull request
Feb 17, 2024
## Description Fixes #2024 This was caused by a read attempt over a lock nested inside a write lock. Thw write lock being `let mut inner = self.0.write()` and the read lock in `self.iroh_data_dir()` ## Notes & open questions I checked the rest of the code in #2013 and I think `author new --switch` is the only command affected ## Change checklist - [ ] Self-review. - [ ] Documentation updates if relevant. - [ ] Tests if relevant.
fubuloubu
pushed a commit
to ApeWorX/iroh
that referenced
this pull request
Feb 21, 2024
…running (n0-computer#2013) ## Description Previously, we were running `RpcStatus::clear`, every time we ran the `iroh start` command (`start::run_with_command`). This meant that even when we correctly exited the `iroh start` command in with the error "iroh is already running", we would then remove the rpc lock file, even though iroh was still running in a different process. Any subsequent calls to `iroh console` or any other iroh commands that expected an iroh node to be running, would assume that a node was *no longer running* because the rpc lock file was gone. This PR adds a new concrete `AlreadyRunningError` that we return from `start_node`. Before we run `RpcStatus::clear`, we check for the `AlreadyRunningError`, and do not clear the lockfile if that error is present. closes n0-computer#2002 ## Notes & open questions **One big change in this PR** Using the `iroh_data_root` function makes it impossible to test anything at the `iroh::start` level, because the `IROH_DATA_DIR` env var makes sure that nothing can be tested in isolation. Setting the `env var` in one test, clobbers setting it in another. I have a commit that adjusts the code to: - run `iroh_data_dir()` once in `main.rs` - cascades the `iroh_data_dir` down through the code from there - remove any other references to calling `iroh_data_dir` anywhere else This mostly effects `commands::console` and `commands::start` ## Change checklist - [x] Self-review. - [x] Documentation updates if relevant. - [x] Tests if relevant.
fubuloubu
pushed a commit
to ApeWorX/iroh
that referenced
this pull request
Feb 21, 2024
…2032) ## Description Fixes n0-computer#2024 This was caused by a read attempt over a lock nested inside a write lock. Thw write lock being `let mut inner = self.0.write()` and the read lock in `self.iroh_data_dir()` ## Notes & open questions I checked the rest of the code in n0-computer#2013 and I think `author new --switch` is the only command affected ## Change checklist - [ ] Self-review. - [ ] Documentation updates if relevant. - [ ] Tests if relevant.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Previously, we were running
RpcStatus::clear
, every time we ran theiroh start
command (start::run_with_command
).This meant that even when we correctly exited the
iroh start
command in with the error "iroh is already running", we would then remove the rpc lock file, even though iroh was still running in a different process.Any subsequent calls to
iroh console
or any other iroh commands that expected an iroh node to be running, would assume that a node was no longer running because the rpc lock file was gone.This PR adds a new concrete
AlreadyRunningError
that we return fromstart_node
. Before we runRpcStatus::clear
, we check for theAlreadyRunningError
, and do not clear the lockfile if that error is present.closes #2002
Notes & open questions
One big change in this PR
Using the
iroh_data_root
function makes it impossible to test anything at theiroh::start
level, because theIROH_DATA_DIR
env var makes sure that nothing can be tested in isolation. Setting theenv var
in one test, clobbers setting it in another.I have a commit that adjusts the code to:
iroh_data_dir()
once inmain.rs
iroh_data_dir
down through the code from thereiroh_data_dir
anywhere elseThis mostly effects
commands::console
andcommands::start
Change checklist