Skip to content

fix(semaphore): ensure holderKeys carry all information needed. Fixes #8684#13553

Merged
Joibel merged 16 commits into
argoproj:mainfrom
pipekit:fix-deadlock-mutex
Sep 18, 2024
Merged

fix(semaphore): ensure holderKeys carry all information needed. Fixes #8684#13553
Joibel merged 16 commits into
argoproj:mainfrom
pipekit:fix-deadlock-mutex

Conversation

@isubasinghe

@isubasinghe isubasinghe commented Sep 3, 2024

Copy link
Copy Markdown
Member

Fixes #8684

Motivation

The Holder keys in the status field of a workflow do not carry enough information to work as expected.
This change ensures a single function (getHolderKey) is used for both acquiring and releasing keys.
This in turn deprecates(getResourceKey).

Modifications

Store the entire holderKey in the status. Simple but effective change to fix #8684.
Allows controllers to support V2 holder names even if the holder was first populated by a v1 holder name.

Verification

The unit tests were run with HOLDER_KEY_VERSION=v2.
NOTE: E2E tests HAVE NOT BEEN RUN WITH THIS ENV VAR.
Largely due to being unable to run the E2E tests in a reliable way on my machine.

@isubasinghe isubasinghe changed the title fix: ensure Holding keys carry all information needed fix: ensure Holding keys carry all information needed. Fixes #8684 Sep 4, 2024
@isubasinghe
isubasinghe marked this pull request as ready for review September 4, 2024 05:02

@isubasinghe isubasinghe left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Generally looks alright, a few minor issues

Comment thread pkg/apis/workflow/v1alpha1/workflow_types.go Outdated
Comment thread pkg/apis/workflow/v1alpha1/workflow_types.go Outdated
Comment thread workflow/controller/operator_concurrency_test.go Outdated
Comment thread workflow/sync/sync_manager.go Outdated

@agilgur5 agilgur5 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In #8684 (comment), you said this would be a breaking change? Then this should have a ! in the title and the appropriate milestone.

Or are you making this backward compatible with the env var?

NOTE: E2E tests HAVE NOT BEEN RUN WITH THIS ENV VAR.
Largely due to being unable to run the E2E tests in a reliable way on my machine.

If this is intended to be required in the future, we should probably enable it during testing similar to #12413 (comment)

@isubasinghe

isubasinghe commented Sep 4, 2024

Copy link
Copy Markdown
Member Author

In #8684 (comment), you said this would be a breaking change? Then this should have a ! in the title and the appropriate milestone.

Or are you making this backward compatible with the env var?

Yeah this should mean that you can upgrade workflows to use the new holder key name without any issue, no longer a breaking change.

NOTE: E2E tests HAVE NOT BEEN RUN WITH THIS ENV VAR.
Largely due to being unable to run the E2E tests in a reliable way on my machine.

If this is intended to be required in the future, we should probably enable it during testing similar to #12413 (comment)

Yeah that sounds good to me.

Comment thread pkg/apis/workflow/v1alpha1/workflow_types.go Outdated
Comment thread workflow/sync/mutex_test.go Outdated
Comment thread workflow/controller/operator_concurrency_test.go Outdated
Comment thread pkg/apis/workflow/v1alpha1/workflow_types.go Outdated
Comment thread docs/environment-variables.md Outdated

@Joibel Joibel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

At minimum we need duplicates of the tests that are V1 only as V2 tests.

My preference is to drop V1 completely, agreeing with @agilgur5

Comment thread docs/environment-variables.md Outdated
Comment thread workflow/sync/sync_manager.go Outdated
Comment thread pkg/apis/workflow/v1alpha1/workflow_types.go Outdated
Comment thread pkg/apis/workflow/v1alpha1/workflow_types.go Outdated
@isubasinghe
isubasinghe requested a review from Joibel September 16, 2024 09:16
@isubasinghe

Copy link
Copy Markdown
Member Author

legacy holding keys have been eliminated, now only v2 style keys exist. Meaning existing keys now test v2 directly.
We upgrade v1 keys to v2. There is a test for this upgrade process in place.

@isubasinghe isubasinghe left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@Joibel opinions? wait please, adding more tests

@isubasinghe
isubasinghe marked this pull request as draft September 16, 2024 09:48
@isubasinghe
isubasinghe marked this pull request as ready for review September 17, 2024 06:19
@isubasinghe

isubasinghe commented Sep 17, 2024

Copy link
Copy Markdown
Member Author

This PR is now ready, I believe I have addressed the edge cases. Unfortunately there is some ambiguity (as expected really) if a sync exist at both the template level and workflow level.

We just choose to go with workflow level in this case of ambiguity.

P.S. I hate this bug

Comment thread workflow/sync/sync_manager.go
Comment thread workflow/sync/sync_manager.go Outdated
Comment thread workflow/sync/sync_manager.go Outdated
Comment thread workflow/sync/sync_manager.go Outdated
Comment thread workflow/sync/sync_manager.go Outdated
Comment thread workflow/sync/sync_manager.go Outdated
Comment thread workflow/sync/sync_manager.go Outdated
Comment thread workflow/sync/sync_manager.go
Comment thread pkg/apis/workflow/v1alpha1/workflow_types.go Outdated
Comment thread workflow/sync/sync_manager_test.go Outdated
Signed-off-by: isubasinghe <isitha@pipekit.io>
Signed-off-by: isubasinghe <isitha@pipekit.io>
Signed-off-by: isubasinghe <isitha@pipekit.io>
Signed-off-by: isubasinghe <isitha@pipekit.io>
Signed-off-by: isubasinghe <isitha@pipekit.io>
Signed-off-by: isubasinghe <isitha@pipekit.io>
Signed-off-by: isubasinghe <isitha@pipekit.io>
Signed-off-by: isubasinghe <isitha@pipekit.io>
Signed-off-by: isubasinghe <isitha@pipekit.io>
Signed-off-by: isubasinghe <isitha@pipekit.io>
Signed-off-by: isubasinghe <isitha@pipekit.io>
Signed-off-by: isubasinghe <isitha@pipekit.io>
Signed-off-by: isubasinghe <isitha@pipekit.io>
Signed-off-by: isubasinghe <isitha@pipekit.io>
Signed-off-by: isubasinghe <isitha@pipekit.io>
Signed-off-by: isubasinghe <isitha@pipekit.io>
@isubasinghe

Copy link
Copy Markdown
Member Author

/retest

1 similar comment
@isubasinghe

Copy link
Copy Markdown
Member Author

/retest

@isubasinghe

Copy link
Copy Markdown
Member Author

Irrelevant tests seem to be broken since a rebase.

@Joibel
Joibel merged commit 440f1cc into argoproj:main Sep 18, 2024
Joibel pushed a commit to pipekit/argo-workflows that referenced this pull request Sep 19, 2024
Joibel pushed a commit that referenced this pull request Sep 20, 2024
@Joibel
Joibel deleted the fix-deadlock-mutex branch November 7, 2024 10:41
Joibel pushed a commit to Joibel/argo-workflows that referenced this pull request Dec 6, 2024
Fixes: argoproj#8684
Backports: argoproj#13553
Signed-off-by: isubasinghe <isitha@pipekit.io>
Co-authored-by: Isitha Subasinghe <isitha@pipekit.io>
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.

Workflow deadlocks on mutex in steps template if controller is restarted

4 participants