Skip to content

Conversation

@shuangkun
Copy link
Member

The condition was inverted - locks should be released when workflows are deleted, not when they exist. Changed from !sm.isWFDeleted(wfKey) to sm.isWFDeleted(wfKey).

This fixes a bug where locks for deleted workflows were not being released, potentially causing resource leaks.

Motivation

Modifications

Verification

Documentation

The condition was inverted - locks should be released when workflows
are deleted, not when they exist. Changed from `!sm.isWFDeleted(wfKey)`
to `sm.isWFDeleted(wfKey)`.

This fixes a bug where locks for deleted workflows were not being
released, potentially causing resource leaks.

Signed-off-by: shuangkun <[email protected]>
@Joibel Joibel added area/mutex-semaphore cherry-pick/3.6 Cherry-pick this to release-3.6 cherry-pick/3.7 Cherry-pick this to release-3.7 labels Dec 11, 2025
Copy link
Member

@Joibel Joibel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isWFDeleted is really badly named.

In the non error case it returns exists which is true if the workflow exists, and false if it doesn't. So it returns the opposite of what you'd expect, so this logic is correct.

I'd appreciate a PR which renames that function, but I think the logic is correct, as the unit test shows.

The function was poorly named - it returns true when the workflow exists
and false when it doesn't, which is the opposite of what the name suggests.
This commit renames:
- IsWorkflowDeleted type to WorkflowExists
- isWFDeleted field to workflowExists
- isWFDeleted variable to workflowExists

The logic remains correct: locks are released when !workflowExists(wfKey),
i.e., when the workflow doesn't exist (is deleted).

Signed-off-by: shuangkun <[email protected]>
@shuangkun shuangkun changed the title fix: correct isWFDeleted logic in CheckWorkflowExistence chore: rename IsWorkflowDeleted to WorkflowExists for clarity Dec 11, 2025
@Joibel Joibel removed cherry-pick/3.6 Cherry-pick this to release-3.6 cherry-pick/3.7 Cherry-pick this to release-3.7 labels Dec 11, 2025
@Joibel Joibel merged commit 6648694 into argoproj:main Dec 11, 2025
41 checks passed
guanguxiansheng pushed a commit to guanguxiansheng/argo-workflows that referenced this pull request Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants