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

Safe shutdown for ipfs node on mac #16978

Closed
spylogsster opened this issue Jul 15, 2021 · 3 comments · Fixed by brave/brave-core#9754
Closed

Safe shutdown for ipfs node on mac #16978

spylogsster opened this issue Jul 15, 2021 · 3 comments · Fixed by brave/brave-core#9754

Comments

@spylogsster
Copy link

spylogsster commented Jul 15, 2021

Description

Someitmes we kill the node without allowing it to remove lock file and it fails launch start next time with error brave_ipfs/repo.lock: someone else has the lock

Steps to Reproduce

  1. Fast start/stop node on macos, especially when node is busy with something as migration
  2. If the node will not respond more than 2 seconds it will be killed without removing lock file
  3. The node will fail start next time with brave_ipfs/repo.lock: someone else has the lock error

Actual result:

Unable to start node

Expected result:

Start/stop node works correctly

Reproduces how often:

rare, only if start/stop when node is busy with something

@spylogsster spylogsster changed the title Shutdown node correctly on mac Safe shutdown for ipfs node on mac Jul 15, 2021
@lidel
Copy link

lidel commented Jul 15, 2021

What is the mechanism Brave uses for stopping go-ipfs?

iirc there ipfs shutdown CLI command can be used for graceful shutdown, alternative is to send SIGHUP, SIGINT or SIGTERM – those should trigger graceful shutdown as well. It will make sure ongoing file transfers finish before shutting down, so may take some time.

If graceful shutdown does not finish within your time budget, SIGKILL will trigger forced shutdown.

When go-ipfs is no longer running, there should be no $IPFS_PATH/repo.lock. If it was left due to forceful shutdown, Brave should remove it before starting it again.

@stephendonner
Copy link

For posterity, this is what it looks like when it happens:

Screen Shot 2021-07-14 at 4 40 32 PM

@stephendonner
Copy link

Verified PASSED using

Brave 1.30.30 Chromium: 92.0.4515.159 (Official Build) nightly (x86_64)
Revision 0185b8a19c88c5dfd3e6c0da6686d799e9bc3b52-refs/branch-heads/4515@{#2052}
OS macOS Version 11.5.2 (Build 20G95)

Steps:

  1. new profile
  2. launched Brave using --enable-logging=stderr --vmodule="*/variations/*"=6,"*/bat-native-ledger/*"=6,"*/brave_rewards/*"=6,"*/bat-native-ads/*"=6,"*/bat-native-confirmations/*"=6,"*/brave_ads/*"=9,"*/brave_user_model/*"=6 --brave-ads-staging --brave-ads-debug --rewards=staging=true,reconcile-interval=3
  3. load brave://ipfs-internals/
  4. click Install and start
  5. clicked Start, Restart, and Stop repeatedly, varying timing a bit (but usually doing so quickly)

Confirmed I never saw Error: lock /Users/stephendonner/Library/Application Support/BraveSoftware/Brave-Browser/brave_ipfs/repo.lock: someone else has the lock which is easily reproducible in earlier builds

before fix with fix
Screen Shot 2021-08-18 at 10 10 47 AM Screen Shot 2021-08-18 at 11 01 31 AM

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

Successfully merging a pull request may close this issue.

3 participants