You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "rbo54 (via GitHub)" <gi...@apache.org> on 2023/12/14 23:13:48 UTC

Re: [I] etcd watch error [apisix-dashboard]

rbo54 commented on issue #2742:
URL: https://github.com/apache/apisix-dashboard/issues/2742#issuecomment-1856917126

   I'm pretty new to etcd, but I see this "invalid auth token" in a context that is very difficult to prevent/recover from I think:
   
   panic: rpc error: code = Unauthenticated desc = etcdserver: invalid auth token
   
   goroutine 62 [running]:
   go.etcd.io/etcd/client/v3/concurrency.(*lockerMutex).Lock(0xc000196000?)
           [/home/tom/go/pkg/mod/go.etcd.io/etcd/client/v3@v3.5.4/concurrency/mutex.go:154](mailto:/home/tom/go/pkg/mod/go.etcd.io/etcd/client/v3@v3.5.4/concurrency/mutex.go:154) +0x45
   github.com/dell/csi-md/md.(*mdsvc).leaseLock(0xc00014a690, {0x1ea8380?, 0xc0006387b0?}, {0xc000864480, 0x27})
           /home/tom/csi-powerflex-rbo54/csi-md/md/service.go:522 +0x365
   github.com/dell/csi-md/md.(*mdsvc).reconcilerOpNodeStage(0x2c7aec0?, 0xc0009517a0, 0xc000618150)
           /home/tom/csi-powerflex-rbo54/csi-md/md/reconciler.go:361 +0x108
   github.com/dell/csi-md/md.(*mdsvc).nodeLookForDegradedVolumes.func1()
           /home/tom/csi-powerflex-rbo54/csi-md/md/reconciler.go:325 +0x4a7
   created by github.com/dell/csi-md/md.(*mdsvc).nodeLookForDegradedVolumes in goroutine 73
           /home/tom/csi-powerflex-rbo54/csi-md/md/reconciler.go:290 +0x4f
   
   Is this believed to be a bug? If so is there a reasonable around? If not am I doing something wrong tih my muse of mutex?
   
   Here is the function I have calling it:
   // leaseLock returns a etcd lock based on a lease held by a session.
   // The lease will be held for up to  3 * the time to the context deadline,
   // or if no context deadline is set, 300 seconds.
   // A unlockFunction and err are returned.
   // Call the unlock function with no arguments to release the lock.
   func (s *mdsvc) leaseLock(ctx context.Context, lockID string) (func(), error) {
   	var sessionDuration int64
   	deadline, ok := ctx.Deadline()
   	if ok {
   		duration := time.Until(deadline)
   		log.Debugf("deadline %v duration %v", deadline, duration)
   		sessionDuration = duration.Milliseconds() * 3 / 1000
   	} else {
   		sessionDuration = 300 // if no deadline, default is 300 seconds
   	}
   	log.Debugf("sessionDuration: %d seconds", sessionDuration)
   	session, err := concurrency.NewSession(s.etcdClient, concurrency.WithTTL(int(sessionDuration)))
   	if err != nil {
   		return nil, err
   	}
   	locker := concurrency.NewLocker(session, ETCD_MD_LEASELOCK_PREFIX+lockID)
   	locker.Lock()
   	return locker.Unlock, nil
   }
   
   I'm running:
   go.etcd.io/etcd/api/v3 v3.5.4 h1:OHVyt3TopwtUQ2GKdd5wu3PmmipR4FTwCqoEjSyRdIc=
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org