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

Always close bootstrap connections from ServerContext.Close() #6215

Merged

Conversation

bbrks
Copy link
Member

@bbrks bbrks commented Apr 26, 2023

Always close cached bootstrap bucket connections when the ServerContext closes - even if we weren't polling for config updates (like when started from a RestTester)

This reduces memory usage, lingering goroutines and connections for tests that start RestTester in persistent config mode (which intentionally does not poll for config updates).

Pre-review checklist

  • Removed debug logging (fmt.Print, log.Print, ...)
  • Logging sensitive data? Make sure it's tagged (e.g. base.UD(docID), base.MD(dbName))
  • Updated relevant information in the API specifications (such as endpoint descriptions, schemas, ...) in docs/api

Integration Tests

…xt closes - even if we weren't polling for config updates
err = base.TerminateAndWaitForClose(sc.BootstrapContext.terminator, sc.BootstrapContext.doneChan, serverContextStopMaxWait)
if err != nil {
base.InfofCtx(ctx, base.KeyAll, "Couldn't stop background config update worker: %v", err)
}

// close cached bootstrap bucket connections
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be inside sc.lock.Lock(), to avoid races calling Connection.Close()?

@adamcfraser adamcfraser merged commit 0863b44 into master Apr 26, 2023
@adamcfraser adamcfraser deleted the always_close_bootstrap_bucket_connections_on_server_close branch April 26, 2023 21:15
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.

2 participants