Skip to content

Add a resource group lock to avoid duplicated creation#4318

Merged
LiliDeng merged 1 commit intomainfrom
baihua/fix_0305
Mar 6, 2026
Merged

Add a resource group lock to avoid duplicated creation#4318
LiliDeng merged 1 commit intomainfrom
baihua/fix_0305

Conversation

@lubaihua33
Copy link
Collaborator

@lubaihua33 lubaihua33 commented Mar 5, 2026

If it is the first time to run LISA and the runbook has lsgstorage notifier, there will be a possibility to create the same lisa shared resource group at the same time. This PR is to add a lock to prevent it from happening.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a per-resource-group lock mechanism to check_or_create_resource_group to prevent race conditions when multiple threads attempt to create the same Azure resource group simultaneously. This can happen when LISA runs for the first time with certain notifier configurations that trigger shared resource group creation from multiple threads.

Changes:

  • Introduces a two-level locking scheme: a global lock (_global_resource_group_creation_lock) to safely manage a dictionary of per-resource-group locks (_global_resource_group_locks), enabling fine-grained concurrency control per resource group name.
  • Refactors the existence check into a helper function _check_existence() and restructures the creation flow to check-then-create under the per-resource-group lock.

You can also share your feedback on Copilot code review. Take the survey.

@LiliDeng LiliDeng merged commit 7988f1c into main Mar 6, 2026
58 checks passed
@LiliDeng LiliDeng deleted the baihua/fix_0305 branch March 6, 2026 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants