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

when etcdserver down, Reject client CPU leakage. #9740

Closed
barnettZQG opened this issue May 18, 2018 · 2 comments
Closed

when etcdserver down, Reject client CPU leakage. #9740

barnettZQG opened this issue May 18, 2018 · 2 comments

Comments

@barnettZQG
Copy link

barnettZQG commented May 18, 2018

when etcd-server down and not restart quickly. client will CPU leakage. It's mainly the following code.
https://github.com/coreos/etcd/blob/ad4e8e94905a3feac3b18511774e242f9d0f860b/clientv3/watch.go#L836:27

func (w *watchGrpcStream) openWatchClient() (ws pb.Watch_WatchClient, err error) {
	for {
		select {
		case <-w.ctx.Done():
			if err == nil {
				return nil, w.ctx.Err()
			}
			return nil, err
		default:
		}
		if ws, err = w.remote.Watch(w.ctx, w.callOpts...); ws != nil && err == nil {
			break
		}
		if isHaltErr(w.ctx, err) {
			return nil, v3rpc.Error(err)
		}
	}
	return ws, nil
}

if error not nil, there are always errors on the server side. so, Why not delay retry?

func (w *watchGrpcStream) openWatchClient() (ws pb.Watch_WatchClient, err error) {
	for {
		select {
		case <-w.ctx.Done():
			if err == nil {
				return nil, w.ctx.Err()
			}
			return nil, err
		default:
		}
		if ws, err = w.remote.Watch(w.ctx, w.callOpts...); ws != nil && err == nil {
			break
		}
		if isHaltErr(w.ctx, err) {
			return nil, v3rpc.Error(err)
		}
		time.Sleep(time.Millisecond * 200)
	}
	return ws, nil
}
@gyuho
Copy link
Contributor

gyuho commented May 18, 2018

Related #9578.

We are actively working on clientv3 balancer rewrite. Once ready, we will address this as well.

@stale
Copy link

stale bot commented Apr 7, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 21 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Apr 7, 2020
@stale stale bot closed this as completed Apr 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants