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

CrossPlatformLockError: Not able to acquire lock. Exceeded amount of retries set in options #7148

Open
maorleger opened this issue Jun 6, 2024 · 6 comments
Labels
documentation Related to documentation. msal-node Related to msal-node package msal-node-extensions Related to msal-node-extensions package Needs: Attention 👋 Awaiting response from the MSAL.js team public-client Issues regarding PublicClientApplications question Customer is asking for a clarification, use case or information.

Comments

@maorleger
Copy link

Core Library

MSAL Node (@azure/msal-node)

Wrapper Library

MSAL Node Extensions (@azure/msal-node-extensions)

Public or Confidential Client?

Public

Documentation Location

https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/extensions/docs/faq.md

Description

Related to Azure/azure-sdk-for-js#29920

@pcdeadeasy has reached out to us with the above error. It seems like, from looking at the code, that this can happen if the .lockfile file is not properly cleaned up.

Is there documentation about how a user can get themselves into a good state? If not, we think it should be documented or ideally self-healed (maybe by checking if the pid who owns the file is still running?)

Otherwise I can see a scenario where terminating processes at the wrong time may leave the system in a bad state.

Could we either document how to correct this issue as a user or self-heal within the code? We (@azure/identity-cache-persistence) can include that in our error message or troubleshooting guide.

@pcdeadeasy feel free to add any asks you have of the MSAL team.

Thanks in advance!

@maorleger maorleger added documentation Related to documentation. question Customer is asking for a clarification, use case or information. labels Jun 6, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: Attention 👋 Awaiting response from the MSAL.js team label Jun 6, 2024
@github-actions github-actions bot added msal-node Related to msal-node package msal-node-extensions Related to msal-node-extensions package public-client Issues regarding PublicClientApplications labels Jun 6, 2024
@pcdeadeasy
Copy link

pcdeadeasy commented Jun 6, 2024

Thanks for filing the issue @maorleger. I can consistently repro this on my machine. Restarting my laptop did not help either. I had to change my code so that token persistence happens with a named file and I was able to work around this.

@sameerag
Copy link
Member

cc @bgavrilMS and @Robbie-Microsoft to check this

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Author Feedback Awaiting response from issue author and removed Needs: Attention 👋 Awaiting response from the MSAL.js team labels Jun 18, 2024
@bgavrilMS
Copy link
Member

bgavrilMS commented Jun 18, 2024

Hi @sameerag - this is a public client issue, as that caching mechanism was never designed for confidential clients (web apps don't use files etc.). @Robbie-Microsoft and I look after confidential client scenarios.

Afaik, the way to self heal is to close the app and delete the lock file manually. Possibly delete the cache file too.

The lock file should be always be deleted, even if the app crashes. There is special flag "DeleteOnClose" that should be used on file creation - see here - and also notice the special Windows flag used.

Also, there seems to be a workaround. Wondering if this is somehow related to Azure SDKs' default config for this cache.

@bgavrilMS
Copy link
Member

Thanks for filing the issue @maorleger. I can consistently repro this on my machine. Restarting my laptop did not help either. I had to change my code so that token persistence happens with a named file and I was able to work around this.

This is interesting. @maorleger - where does Azure SDK default to create the file persistence if he app developer doesn't specify?

@maorleger
Copy link
Author

maorleger commented Jun 18, 2024

Thanks for filing the issue @maorleger. I can consistently repro this on my machine. Restarting my laptop did not help either. I had to change my code so that token persistence happens with a named file and I was able to work around this.

This is interesting. @maorleger - where does Azure SDK default to create the file persistence if he app developer doesn't specify?

👋 By default we will use .IdentityService under the platform specific local folder as the directory. The file name will be msal.cache.<suffix> (where the suffix may be cae or nocae)

For example, on my wsl instance, it defaults to $HOME/.IdentityService/msal.cache.<suffix>

Hope that helps!

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 Awaiting response from the MSAL.js team and removed Needs: Author Feedback Awaiting response from issue author labels Jun 18, 2024
@dominic-simplan
Copy link

We are having the same issue in our Electron application which is using @azure/msal-node and the PersistenceCachePlugin from @azure/msal-node-extensions.
The issue has occured at least three times in the last three month on customer (Windows) systems. We don't know which constellation causes the issue though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Related to documentation. msal-node Related to msal-node package msal-node-extensions Related to msal-node-extensions package Needs: Attention 👋 Awaiting response from the MSAL.js team public-client Issues regarding PublicClientApplications question Customer is asking for a clarification, use case or information.
Projects
None yet
Development

No branches or pull requests

5 participants