Skip to content
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

[node-core-library] Fix an issue where attempting to acquire multiple LockFiles at the same time on POSIX would cause the second to immediately be acquired without releasing the first. #4920

Merged
merged 11 commits into from
Sep 12, 2024

Conversation

iclanton
Copy link
Member

@iclanton iclanton commented Sep 12, 2024

Summary

This PR fixes an issue where attempting to acquire multiple LockFiles at the same time on POSIX would cause the second to immediately be acquired without releasing the first.

It also renames LockFile.acquire to LockFile.acquireAsync and refactors the credential management code in the Rush Azure Storage plugin to only lock the credential cache after a new credential has been acquired.

Details

The lockfile issue was fixed by keeping a list of in-proc acquired lockfiles. If one already exists, acquiring a lockfile will fail early, before touching the disk.

How it was tested

Introduced a unit test.

libraries/node-core-library/src/LockFile.ts Outdated Show resolved Hide resolved
libraries/node-core-library/src/LockFile.ts Outdated Show resolved Hide resolved
libraries/node-core-library/src/LockFile.ts Show resolved Hide resolved
libraries/node-core-library/src/LockFile.ts Outdated Show resolved Hide resolved
@iclanton iclanton merged commit 7f838f9 into microsoft:main Sep 12, 2024
4 checks passed
@iclanton iclanton deleted the lockfile-fixes branch September 12, 2024 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

3 participants