prysmaticlabs / prysm

Issues with cancel func returned by context.WithCancel VET-V0011
Bug risk
Major
2 months agoa year old
the cancel function is not used on all paths (possible context leak)
 84			span.AddAttributes(trace.Int64Attribute("slot", int64(slot))) // lint:ignore uintcast -- This conversion is OK for tracing.
 85
 86			deadline := v.SlotDeadline(slot)
 87			slotCtx, cancel := context.WithDeadline(ctx, deadline) 88			log := log.WithField("slot", slot)
 89			log.WithField("deadline", deadline).Debug("Set deadline for proposals and attestations")
 90
this return statement may be reached without using the cancel var defined on line 87
 76			span.End()
 77			sub.Unsubscribe()
 78			close(accountsChangedChan)
 79			return // Exit if context is canceled. 80		case slot := <-v.NextSlot():
 81			if !healthTracker.IsHealthy() {
 82				continue