-
Notifications
You must be signed in to change notification settings - Fork 357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: deadlock issue #9728
Merged
Merged
fix: deadlock issue #9728
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1b0cba1
fix: deadlock issue
amandavialva01 0832e0e
add test and address comments
amandavialva01 0e68ba7
adjust test config
amandavialva01 06fa978
testing changes
amandavialva01 f50f82f
fix lint
amandavialva01 ea877a2
create and pass down lock indicator and cleanup tests
amandavialva01 4a2edd9
remove gateway service from singleRM cluster config
amandavialva01 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import uuid | ||
from typing import Tuple | ||
|
||
import pytest | ||
import urllib3 | ||
|
||
from determined.common.api import bindings | ||
from tests import api_utils | ||
from tests import config as conf | ||
from tests.task import task | ||
|
||
|
||
# Workspace-namespace binding requests were causing a deadlock in our Kubernetes jobs handler when | ||
# a thread that locks the jobsService tries to reacquire the lock during the execution of a callback | ||
# function that only gets called when a job is running in the namespace that we want to bind to the | ||
# workspace. Verify that we don't run into this deadlock when triggering multiple calls to the | ||
# API handler that binds a workspace to an auto-created namespace, as this request can trigger the | ||
# deadlock if the namespace (or verify the existence of for the first time) is running a job. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I love this explanation! Great comment and great test. |
||
@pytest.mark.e2e_single_k8s | ||
@pytest.mark.timeout(3 * 60) | ||
def test_wksp_running_task_check_namespace(namespaces_created: Tuple[str, str]) -> None: | ||
sess = api_utils.admin_session() | ||
namespace, _ = namespaces_created | ||
wksp_namespace_meta = bindings.v1WorkspaceNamespaceMeta( | ||
namespace=namespace, | ||
) | ||
sess._max_retries = urllib3.util.retry.Retry(total=5, backoff_factor=0.5) | ||
cluster_name = conf.DEFAULT_RM_CLUSTER_NAME | ||
|
||
# Create a workspace bound to an auto-created namespace. | ||
body = bindings.v1PostWorkspaceRequest(name=f"workspace_{uuid.uuid4().hex[:8]}") | ||
body.clusterNamespaceMeta = {cluster_name: wksp_namespace_meta} | ||
resp = bindings.post_PostWorkspace(sess, body=body) | ||
wksp_id = resp.workspace.id | ||
notebook_id = bindings.post_LaunchNotebook( | ||
sess, | ||
body=bindings.v1LaunchNotebookRequest(workspaceId=wksp_id), | ||
).notebook.id | ||
|
||
# Wait for the notebook to start or run. | ||
task.wait_for_task_start(sess, notebook_id, start_or_run=True) | ||
|
||
# Set a workspace-namespace binding using the same auto-created namespace. | ||
content = bindings.v1SetWorkspaceNamespaceBindingsRequest(workspaceId=wksp_id) | ||
namespace_meta = bindings.v1WorkspaceNamespaceMeta( | ||
namespace=namespace, | ||
) | ||
content.clusterNamespaceMeta = {cluster_name: namespace_meta} | ||
|
||
# Can we run this request repeatedly with no deadlock? | ||
for _ in range(3): | ||
bindings.post_SetWorkspaceNamespaceBindings(sess, body=content, workspaceId=wksp_id) | ||
|
||
# Cleanup. | ||
bindings.delete_DeleteWorkspace(sess, id=wksp_id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, why is this deleted? Was it a bit of cleanup discovered during testing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeaa, I think we only need to use a gateway for mutliRM to make tasks that create resources in the remote cluster (the cluster tied to the additional RM) accessible to the determined master, so single RM clusters don't need that config!