Skip to content

fix: race conditions and memory leaks in validator names and frontend cache#742

Merged
pk910 merged 4 commits into
ethpandaops:masterfrom
Sahil-4555:fix/concurrent-map-access-and-goroutine-leak
Jun 16, 2026
Merged

fix: race conditions and memory leaks in validator names and frontend cache#742
pk910 merged 4 commits into
ethpandaops:masterfrom
Sahil-4555:fix/concurrent-map-access-and-goroutine-leak

Conversation

@Sahil-4555

Copy link
Copy Markdown
Contributor

What's the problem?

Found two bugs that can cause crash:

  1. Validator names service crashes every 6 hours - Background job and HTTP requests were accessing same maps without proper locks
  2. Memory leak from stuck goroutines - Timeout handling was leaving worker goroutines blocked forever

How does the race happen?

For validator names:

  • Background updater runs resolveNames() every 6 hours (takes ~60 seconds)
  • Meanwhile, users visiting /validators page call GetValidatorName()
  • Both access same maps: resolveNames() writes without lock, GetValidatorName() reads WITH lock
  • Go panics: fatal error: concurrent map read and map write -> crash

For frontend cache:

  • Slow page loads timeout after 30s, main goroutine returns
  • Worker goroutine completes later, tries sending to unbuffered channel
  • No one listening anymore -> worker blocks forever -> memory leak
  • Plus isTimedOut boolean had data race

@pk910 pk910 merged commit a076cc3 into ethpandaops:master Jun 16, 2026
5 checks passed
@Sahil-4555 Sahil-4555 deleted the fix/concurrent-map-access-and-goroutine-leak branch June 17, 2026 02:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants