Compare commits

...

1 Commits

Author SHA1 Message Date
Galoretka
6027518ad5 fix: stop SlotIntervalTicker goroutine leaks (#16241)
`SlotIntervalTicker` was created in `prepareForkChoiceAtts` and in the
fork-choice attestation processing routine without ever calling `Done()`
when the service context was cancelled. Once the consuming goroutine
exits on `ctx.Done()`, the ticker keeps running and eventually blocks on
sending to its channel, leaving a leaked goroutine behind.

This change wires the lifetime of the `SlotIntervalTicker` to the
corresponding service contexts by calling `ticker.Done()` on
`ctx.Done()` in both call sites. This keeps the behaviour of the
routines unchanged while ensuring the ticker goroutines exit cleanly on
shutdown, consistent with how regular `SlotTicker` is handled elsewhere
in the codebase.
2026-01-14 17:14:17 +00:00
3 changed files with 5 additions and 0 deletions

View File

@@ -94,6 +94,7 @@ func (s *Service) spawnProcessAttestationsRoutine() {
for {
select {
case <-s.ctx.Done():
ticker.Done()
return
case slotInterval := <-ticker.C():
if slotInterval.Interval > 0 {

View File

@@ -49,6 +49,7 @@ func (s *Service) prepareForkChoiceAtts() {
}
case <-s.ctx.Done():
log.Debug("Context closed, exiting routine")
ticker.Done()
return
}
}

View File

@@ -0,0 +1,3 @@
### Fixed
- stop SlotIntervalTicker goroutine leaks [#16241](https://github.com/OffchainLabs/prysm/pull/16241)