Skip to content

GetRuns() cache miss window allows N concurrent callers to each spawn 17+ goroutines with no re-check #7053

@aashu2006

Description

@aashu2006

User Request

Type: bug
Target: Console Application
Submitted by: @aashu2006
Console Request ID: 70ef397d-4904-4593-8488-5769dc92e9b2

Description

What happened:
In pkg/api/handlers/nightly_e2e.go:223-257, after RUnlock() at line 234, all concurrent GetRuns callers miss the cache and independently call h.fetchAll(). The write lock at line 251 does not re-check whether another goroutine already populated the cache — it unconditionally overwrites it. Each fetchAll() call spawns 17+ goroutines.

What I expected:
A re-check under the write lock should prevent redundant cache writes. singleflight should coalesce concurrent cold-cache fetches into one.

Steps to reproduce:

  1. Let the cache expire
  2. Send 10 concurrent GetRuns requests
  3. Observe 10 × 17+ goroutines spawned for concurrent fetches

This issue was automatically created from the KubeStellar Console.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai-fix-requestedai-processingAI is currently processing this issuekind/bugCategorizes issue or PR as related to a bug.triage/acceptedIndicates an issue or PR is ready to be actively worked on.triage/neededNeeds triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions