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

refactor: More cleanup of server/start.go #16238

Merged
merged 9 commits into from
May 22, 2023
Merged

Conversation

ValarDragon
Copy link
Contributor

@ValarDragon ValarDragon commented May 20, 2023

Description

Address some TODO's I left in server/start.go from #15041

This PR has five changes, beyond some line count / complexity reduction. Namely:

  • Get and validate config before doing any store work
  • Start the trace server before opening the database
  • Actually close the trace server
  • Don't create a p2p node key when you are in grpc only mode
  • Extract common starting logic between startStandAlone and startInProcess

These weren't done in #15041 in order for that PR to be changing no functionality.


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@ValarDragon ValarDragon requested a review from a team as a code owner May 20, 2023 16:22
@ValarDragon
Copy link
Contributor Author

ValarDragon commented May 20, 2023

Are we sure this orjitech leaking resource linter is right? I fail to see how this code change can have a leak whereas the old code didn't. (Also it can't actually be a leak in context, as this function's termination means program termination...)

Please let me know if this is a leakage, I don't see it! If not, how do I suppress the error here?

if err != nil {
return err
}
defer appCleanupFn()
Copy link
Contributor Author

@ValarDragon ValarDragon May 20, 2023

Choose a reason for hiding this comment

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

The tracestore defer is moved up here, which is equivalent to before with startInProcess, as the tracestore was cleaned up after the tmNode.

(It wasn't cleaned up for startStandAlone at all before)

@yihuang
Copy link
Collaborator

yihuang commented May 20, 2023

#16208 I had a similar pr here, seems to be a subset of your pr

@@ -542,6 +519,7 @@ func startAPIServer(ctx context.Context, g *errgroup.Group, cmtCfg *cmtcfg.Confi
}
// TODO: Why do we reload and unmarshal the entire genesis doc in order to get the chain ID.
// surely theres a better way. This is likely a serious node start time overhead.
// Shouldn't it be in cmtCfg.ChainID() ?
Copy link
Member

Choose a reason for hiding this comment

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

the genesis and config can have the incorrect values if a user is syncing from a snapshot, im not sure if this is needed

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 see, RIP

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we move this into a follow-up issue for StartAPIServer: how to get chain-id ?

Copy link
Member

@tac0turtle tac0turtle left a comment

Choose a reason for hiding this comment

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

UTack

@ValarDragon
Copy link
Contributor Author

@yihuang so sorry I missed that, I would've just waited!

Looks like both PR's do independently helpful things, I think we should get both sets of changes in

server/start.go Fixed Show fixed Hide fixed
@ValarDragon ValarDragon added this pull request to the merge queue May 22, 2023
Merged via the queue into main with commit 38f27e3 May 22, 2023
@ValarDragon ValarDragon deleted the dev/more_server_cleanup branch May 22, 2023 11:27
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