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

Consul PUT api does not reuse tcp connection #8518

Open
hehailong5 opened this issue Aug 15, 2020 · 3 comments
Open

Consul PUT api does not reuse tcp connection #8518

hehailong5 opened this issue Aug 15, 2020 · 3 comments
Labels
theme/api Relating to the HTTP API interface type/bug Feature does not function as expected

Comments

@hehailong5
Copy link

version: from 0.8.4 to the latest

We've tried version 0.8.4, 1.6.6 and the latest, and found /v1/catalog/register and /v1/catalog/deregister have this problem. this could leave a bunch of TIME_WAIT entries and finally exhaust the fds.

@dnephin
Copy link
Contributor

dnephin commented Aug 18, 2020

Thank you for reporting this issue! I think this may be the same issue that was reported in #3316. Can you tell us more about how you are making those API calls? Are you using the consul/api client library, or are you using some other http client?

@dnephin dnephin added theme/api Relating to the HTTP API interface type/bug Feature does not function as expected labels Aug 18, 2020
@hehailong5
Copy link
Author

hehailong5 commented Aug 19, 2020

Hello,

We use the consul/api client library in our golang program with the client created with api.DefaultConfig()

@boxofrad
Copy link
Contributor

Hi @hehailong5 👋🏻

I've taken a look at this today and was unfortunately unable to reproduce the issue you've encountered. I do have a couple of observations, though:

  1. Connections cannot be re-used/shared between HTTP/1.1 requests made in parallel (without pipelining, which isn't well-supported). If you're making requests from multiple goroutines then it may account for this behavior.
  2. The default HTTP transport has an IdleConnTimeout of 90 seconds and has a limit on the number of idle connections that will be held open (this is derived from GOMAXPROCS). If your code makes infrequent use of the client, or sleeps for longer than 90 seconds between use, it's likely that connections will have been closed. These settings can be overridden by providing your own http.Transport.

Hope that helps! Please let us know if you're still encountering problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/api Relating to the HTTP API interface type/bug Feature does not function as expected
Projects
None yet
Development

No branches or pull requests

3 participants