-
Notifications
You must be signed in to change notification settings - Fork 10.2k
Open
Labels
Description
Bug report criteria
- This bug report is not security related, security issues should be disclosed privately via etcd maintainers.
- This is not a support request or question, support requests or questions should be raised in the etcd discussion forums.
- You have read the etcd bug reporting guidelines.
- Existing open issues along with etcd frequently asked questions have been checked and this is not a duplicate.
What happened?
In the NewSession function within client/v3/concurrency/session.go, the RPC call LeaseGrant is invoked without a deadline, as shown below.
resp, err := client.Grant(ops.ctx, int64(ops.ttl))However, LeaseGrant should be called with a deadline set to the ttl value, similar to how the LeaseRevoke RPC is handled with a deadline set to ttl value when closing the session. Otherwise LeaseGrant may stuck and block the NewSession function endlessly.
func (s *Session) Close() error {
s.Orphan()
// if revoke takes longer than the ttl, lease is expired anyway
ctx, cancel := context.WithTimeout(s.opts.ctx, time.Duration(s.opts.ttl)*time.Second)
_, err := s.client.Revoke(ctx, s.id)
cancel()
return err
}What did you expect to happen?
RPC LeaseGrant can return DeadlineExceeded to avoid endless stuck.
How can we reproduce it (as minimally and precisely as possible)?
When NewSession is called, internal RPC LeaseGrant may stuck and block this function endlessly.
Anything else we need to know?
No response
Etcd version (please run commands below)
$ etcd --version
v3.5.12
$ etcdctl version
# paste output hereEtcd configuration (command line flags or environment variables)
paste your configuration here
Etcd debug information (please run commands below, feel free to obfuscate the IP address or FQDN in the output)
$ etcdctl member list -w table
# paste output here
$ etcdctl --endpoints=<member list> endpoint status -w table
# paste output here