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

etcd: add a read/write timeout to server #880

Merged
merged 1 commit into from
Jul 7, 2014

Conversation

philips
Copy link
Contributor

@philips philips commented Jul 5, 2014

The default is for connections to last forever[1]. This leads to fds leaking.
I set the timeout so high by default so that watches don't have to keep
retrying but perhaps we should set it slower.

Tested on a cluster with lots of clients and it seems to have relieved the
problem.

[1] https://groups.google.com/forum/#!msg/golang-nuts/JFhGwh1q9xU/heh4J8pul3QJ

@xiang90
Copy link
Contributor

xiang90 commented Jul 5, 2014

lgtm

@philips
Copy link
Contributor Author

philips commented Jul 5, 2014

@xiangli-cmu I am going to add flags to control this. I will also set a longish timeout on the peer address (5 min) and leave it hard coded unless we have a need to make it shorter.

@@ -255,6 +259,9 @@ func (c *Config) LoadFlags(arguments []string) error {
f.StringVar(&c.Peer.CertFile, "peer-cert-file", c.Peer.CertFile, "")
f.StringVar(&c.Peer.KeyFile, "peer-key-file", c.Peer.KeyFile, "")

f.Float64Var(&c.HTTPReadTimeout, "read-timeout", c.HTTPReadTimeout, "")
Copy link
Contributor

Choose a reason for hiding this comment

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

using "http-read-timeout" here?
The name for flags is different from toml's and env's.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@unihorn good catch, fixed in 084dcb5

The default is for connections to last forever[1]. This leads to fds
leaking. I set the timeout so high by default so that watches don't have
to keep retrying but perhaps we should set it slower.

Tested on a cluster with lots of clients and it seems to have relieved
the problem.

[1] https://groups.google.com/forum/#!msg/golang-nuts/JFhGwh1q9xU/heh4J8pul3QJ
@philips
Copy link
Contributor Author

philips commented Jul 7, 2014

ping @xiangli-cmu @unihorn. Can I merge and release or did you have more thoughts on the write timeout?

@yichengq
Copy link
Contributor

yichengq commented Jul 7, 2014

lgtm.

philips added a commit that referenced this pull request Jul 7, 2014
etcd: add a read/write timeout to server
@philips philips merged commit a8d966d into etcd-io:master Jul 7, 2014
@porjo
Copy link

porjo commented Jul 18, 2014

@philips this change has uncovered a bad side-effect in go-etcd, specifically in Watch(). When the timeout happens, the http response has an empty body but no check is being done before Unmarshall() is run on it, so you get: error: unexpected end of JSON input.

What I'm not sure about is whether the empty http body is expected behaviour...if that's the case, then go-etcd should be modified to work around it.

@philips
Copy link
Contributor Author

philips commented Jul 18, 2014

@porjo Thank you for the report. We should fix go-etcd in this case.

@porjo
Copy link

porjo commented Jul 19, 2014

Ah, it looks like this has already been reported in coreos/go-etcd#143. I should've checked there first!

titanous added a commit to flynn/flynn that referenced this pull request Aug 8, 2014
Since etcd-io/etcd#880 watches will timeout after five minutes, this patch reconnects when this happens.

Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants