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

fix: worker: Close all storage paths on worker shutdown #9153

Merged
merged 4 commits into from
Aug 11, 2022

Conversation

shrenujbansal
Copy link
Contributor

@shrenujbansal shrenujbansal commented Aug 10, 2022

Related Issues

#5227
#7570

Proposed Changes

Add an API to close all paths for a worker which is then used during worker shutdown to properly clear state

Additional Info

Checklist

Before you mark the PR ready for review, please make sure that:

  • All commits have a clear commit message.
  • The PR title is in the form of of <PR type>: <area>: <change being made>
    • example: fix: mempool: Introduce a cache for valid signatures
    • PR type: fix, feat, INTERFACE BREAKING CHANGE, CONSENSUS BREAKING, build, chore, ci, docs,perf, refactor, revert, style, test
    • area: api, chain, state, vm, data transfer, market, mempool, message, block production, multisig, networking, paychan, proving, sealing, wallet, deps
  • This PR has tests for new functionality or change in behaviour
  • If new user-facing features are introduced, clear usage guidelines and / or documentation updates should be included in https://lotus.filecoin.io or Discussion Tutorials.
  • CI is green

@shrenujbansal shrenujbansal requested a review from a team as a code owner August 10, 2022 21:10
@shrenujbansal shrenujbansal changed the title Close all storage paths on worker shutdown fix: worker: Close all storage paths on worker shutdown Aug 10, 2022
@shrenujbansal shrenujbansal force-pushed the sbansal/detach-storage-on-worker-shutdown branch from 18ce082 to 10dba44 Compare August 10, 2022 21:44

// Detach any storage associated with this worker
err = api.StorageDetachAll(ctx)
if err != nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm of the opinion that we should continue execution since shutdown should be best effort and should not be stopped if we can't close some paths
But the linter doesn't allow me ignore the return. Is there a better way to do this here? What are your thoughts?

Copy link
Contributor

@geoff-vball geoff-vball Aug 10, 2022

Choose a reason for hiding this comment

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

replace err with _ if you want to explicitly ignore a return value. Leave a helpful comment with why you're doing so :)

In this case we can probably just log the error instead of returning if we want to continue on.

@rjan90
Copy link
Contributor

rjan90 commented Aug 11, 2022

Tested this today, and it closed the storage path correctly here. Not seeing any errors when running lotus-miner storage list after stopping the lotus-worker.

2022-08-11T11:45:49.630+0200    WARN    stores  paths/index.go:293      Dropping sector storage {"path": "19c858be-9b1a-4ef5-9eaa-5595d4cff6cf", "url": "http://127.0.0.1:3456/remote", "droppedEntries": 0, "droppedPrimaryEntries": 0, "droppedDecls": 0}
2022-08-11T11:45:53.667+0200    WARN    advmgr  sealer/sched_worker.go:90       Worker closing  {"workerid": "a2400659-ece2-4826-a2bd-dc95c9392eb9"}

@geoff-vball geoff-vball merged commit 525ee3b into master Aug 11, 2022
@geoff-vball geoff-vball deleted the sbansal/detach-storage-on-worker-shutdown branch August 11, 2022 19:01
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.

4 participants