Skip to content

Conversation

@Joibel
Copy link
Member

@Joibel Joibel commented Feb 10, 2026

Fixes #15218

Motivation

The CheckWorkflowExistence, Release, and ReleaseAll methods in the sync manager were using read locks (RLock) when they should be using write locks (Lock). These methods modify the internal state of the sync manager (accessing and potentially modifying sm.syncLockMap), which requires exclusive write access rather than shared read access.

Modifications

Changed the following methods from using RLock()/RUnlock() to Lock()/Unlock():

  • CheckWorkflowExistence() - iterates and modifies sync lock map
  • Release() - modifies sync lock map entries
  • ReleaseAll() - modifies sync lock map entries

This ensures proper synchronization and prevents race conditions when multiple goroutines access these methods concurrently.

Verification

  • Code review of lock usage patterns in the sync manager
  • Verify that these methods perform write operations on shared state
  • Run existing tests to ensure no regressions

Documentation

No documentation changes needed - this is an internal synchronization fix.

AI

Co-authored with Claude

…nce to prevent concurrent map access

The prioritySemaphore.lockHolder map was accessed concurrently without
synchronization. Manager.Release, ReleaseAll, and CheckWorkflowExistence
used RLock (shared read lock), allowing multiple goroutines to
read/write the same prioritySemaphore.lockHolder map simultaneously.

Change these methods to use Lock (exclusive write lock) so they are
mutually exclusive with each other and with TryAcquire, preventing
concurrent map access on prioritySemaphore's internal state.

Signed-off-by: Alan Clucas <alan@clucas.org>

https://claude.ai/code/session_01AD92yQipDQmgjvxdyveag4
@Joibel Joibel marked this pull request as draft February 10, 2026 13:33
@Joibel Joibel marked this pull request as ready for review February 11, 2026 08:17
@Joibel Joibel merged commit 2d95ada into argoproj:main Feb 11, 2026
69 of 70 checks passed
@Joibel Joibel added cherry-pick/3.7 Cherry-pick this to release-3.7 cherry-pick/4.0 Cherry-pick this to release-4.0 labels Feb 11, 2026
@argo-cd-cherry-pick-bot
Copy link

❌ Cherry-pick failed for 3.7. Please check the workflow logs for details.

@argo-cd-cherry-pick-bot
Copy link

🍒 Cherry-pick PR created for 4.0: #15549

clintmoyer pushed a commit to clintmoyer/argo-workflows that referenced this pull request Feb 11, 2026
Joibel added a commit that referenced this pull request Feb 11, 2026
…for 4.0) (#15549)

Co-authored-by: Alan Clucas <alan@clucas.org>
Joibel added a commit that referenced this pull request Feb 11, 2026
(cherry picked from commit 2d95ada)

Signed-off-by: Alan Clucas <alan@clucas.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-pick/3.7 Cherry-pick this to release-3.7 cherry-pick/4.0 Cherry-pick this to release-4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Controller panics due to concurrent map writes when using semaphore

2 participants