Skip to content

fix: IntelligentPrefetcher updates JobsQueued/JobsCompleted without synchronization #104

Closed

Description

@scttfrdmn

Bug

internal/cache/predictive.go IntelligentPrefetcher updates stats.JobsQueued and stats.JobsCompleted from multiple goroutines (worker pool) without any synchronization, causing data races detectable by go test -race.

Fix

Use sync/atomic.AddUint64 for both counter updates.

Impact

Data race on stats counters; undefined behavior under Go's memory model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: cachepriority: mediumtype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions