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

Some fixes to connection pooling #7045

Merged
merged 2 commits into from
Feb 3, 2020
Merged

Some fixes to connection pooling #7045

merged 2 commits into from
Feb 3, 2020

Conversation

notnoop
Copy link
Contributor

@notnoop notnoop commented Jan 31, 2020

Pick up some fixes from Consul:

  • If a stream returns an EOF error, clear session from cache/pool and start a new one.
  • Close the codec when closing StreamClient

Pick up some fixes from Consul:

* If a stream returns an EOF error, clear session from cache/pool and start a
new one.
* Close the codec when closing StreamClient
@notnoop notnoop added this to the 0.10.4 milestone Jan 31, 2020
@notnoop notnoop requested a review from schmichael January 31, 2020 20:37
@notnoop notnoop self-assigned this Jan 31, 2020
// new session next time
// See https://github.com/hashicorp/consul/blob/v1.6.3/agent/pool/pool.go#L471-L477
if lib.IsErrEOF(err) {
p.clearConn(conn)
Copy link
Member

Choose a reason for hiding this comment

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

In getClient above on L406 we call release and clear in the opposite order. Looking at the code I don't think it matters and calling releaseConn doesn't even seem necessary if we're calling clearConn.

It might be nice to make the 2 clear+releaseConn cases the same, but it's not a blocker. I don't see any reason why either would be unsafe.

Copy link
Contributor Author

@notnoop notnoop Feb 3, 2020

Choose a reason for hiding this comment

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

Done - also your proposed order matches Consul's code too. Thanks for catching this.

This to be consistent with other connection clean up handler as well as consul's https://github.com/hashicorp/consul/blob/v1.6.3/agent/pool/pool.go#L468-L479 .
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants