You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
KeepAlive in etcd client cannot ensure the permanent validity of lease. If automatic renewal of trillian lease is interrupted due to unexpected circumstances, trillian will still continue operating. However, the program will never be detected by ETCD server, and as a result it can no longer provide services. In addition, external process health check program cannot discover abnormalities and warnings cannot be sent to system administrators in time.
// AnnounceSelf announces this binary's presence to etcd.funcAnnounceSelf(ctx context.Context, client*clientv3.Client, etcdService, endpointstring) func() {
ifclient==nil {
returnfunc() {}
}
// Get a lease so our entry self-destructs.leaseRsp, err:=client.Grant(ctx, 30)
iferr!=nil {
glog.Exitf("Failed to get lease from etcd: %v", err)
}
client.KeepAlive(ctx, leaseRsp.ID)
...
// recvKeepAlive updates a lease based on its LeaseKeepAliveResponsefunc (l*lessor) recvKeepAlive(resp*pb.LeaseKeepAliveResponse) {
karesp:=&LeaseKeepAliveResponse{
ResponseHeader: resp.GetHeader(),
ID: LeaseID(resp.ID),
TTL: resp.TTL,
}
l.mu.Lock()
deferl.mu.Unlock()
ka, ok:=l.keepAlives[karesp.ID]
if!ok {
return
}
ifkaresp.TTL<=0 {
// lease expired; close all keep alive channelsdelete(l.keepAlives, karesp.ID)
ka.close()
return
}
...
Meanwhile, because trillian did not consume LeaseKeepAliveResponse channel immediately, ETCD client would print a large number of warnings #2249 .
The text was updated successfully, but these errors were encountered:
px3303
changed the title
keepAlive in etcd client cannot ensure the permanent validity of lease
KeepAlive in etcd client cannot ensure the permanent validity of lease
Jan 12, 2022
This PR can let trillian proactively Listen "LeaseKeepAliveResponse" channel returned by KeepAlive in ETCD client. When automatic renewal interruption is detected, Exit the program by canceling the context.
Fixes#2654,#2249
Co-authored-by: Simba Peng <[email protected]>
Co-authored-by: Martin Hutchinson <[email protected]>
KeepAlive
in etcd client cannot ensure the permanent validity of lease. If automatic renewal oftrillian
lease is interrupted due to unexpected circumstances, trillian will still continue operating. However, the program will never be detected by ETCD server, and as a result it can no longer provide services. In addition, external process health check program cannot discover abnormalities and warnings cannot be sent to system administrators in time.Meanwhile, because
trillian
did not consumeLeaseKeepAliveResponse
channel immediately, ETCD client would print a large number of warnings #2249 .The text was updated successfully, but these errors were encountered: