Skip to content

[M3] Global exclusive lock held during entire reconciliation makes MaxConcurrentReconciles useless #282

Description

@pradeepto

Severity: Medium

Category

Performance / Concurrency

Files

internal/controller/group_controller.go:166-167

Description

CacheMutex.Lock() is acquired before the LDAP fetch and held through all backend API calls and cache updates. When MaxConcurrentReconciles > 1 is configured, all reconciler goroutines still serialize on this mutex. LDAP queries and backend API calls run while holding the lock so slow external calls block every other reconciliation.

The lock effectively makes concurrent reconciliation a no-op.

Fix

Move the lock to wrap only the cache read/write operations. Release it before making LDAP queries and backend API calls. Use a read lock for cache reads and write lock only for cache mutations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions