Concurrency Issue with Slugify Function #18369
Labels
bug
Something isn't working
component:application-sets
Bulk application management related
version:2.11
Latest confirmed affected version is 2.11
Checklist:
argocd version
.Describe the bug
The Slugify function is currently not safe when accessed concurrently from multiple goroutines. Uncontrolled access to shared global state can cause data races where
Slugify
returns inconsistent results with the same input. This is a fairly serious problem for my organization as we utilize ApplicationSets (app of apps pattern) and intentionally don't self-heal. This leads to application sets utilizingslugify
to render different application names when there is enough activity where different goroutines utilizeSlugifyName
. Subsequently, applications are destroyed, recreated, and left in an OutOfSync state.In our situation, we enabled
preserveResourcesOnDeletion
for AppSets that useslugify
. This prevents deleting underlying K8s resources, but the application and app set recreation are not ideal, as we have an alert condition when they are out of sync.To Reproduce
It is difficult to reproduce organically. One can create an appset + generator that utilizes Slugify with different max lengths and monitors Kubernetes audit log deletion and recreation.
Running the test in this PR: #18370 without including the fix would demonstrate the problem.
Expected behavior
SlugifyName
with the same input parameters should be idempotent regardless of concurrent usage.Screenshots
Version
Logs
The text was updated successfully, but these errors were encountered: