vscode-azure-account icon indicating copy to clipboard operation
vscode-azure-account copied to clipboard

Entry not found in cache

Open chrmarti opened this issue 6 years ago • 17 comments

From @jdneo in https://github.com/Microsoft/vscode-azure-account/issues/45#issuecomment-380321789:

Hi @chrmarti I found out a way to reproduce Entry not found in cache error. Just trigger the Azure: Open bash in clould shell twice.

More details can be found in the gif below:

report

chrmarti avatar Apr 12 '18 15:04 chrmarti

Hi @chrmarti , Seems I found the root cause. It might be a bug in adal lib.

I create an issue: https://github.com/AzureAD/azure-activedirectory-library-for-nodejs/issues/197

Correct me if I'm wrong. 😄

jdneo avatar Apr 13 '18 08:04 jdneo

@jdneo I cannot reproduce this myself currently. Is it still a problem and would it be fixed by the PR AzureAD/azure-activedirectory-library-for-nodejs#188?

chrmarti avatar May 04 '18 14:05 chrmarti

@chrmarti

I can still repro this on my side, the steps are:

  • Make sure the Azure Account is signed out at first
  • Trigger Open bash in Cloud Shell
  • Sign in
  • Wait for the Cloud Shell connected
  • Dispose the Cloud Shell terminal
  • Trigger Open bash in Cloud Shell again

jdneo avatar May 05 '18 22:05 jdneo

That reproduces it and the PR you linked seems to fix it. Now we just need that fix in adal-node.

chrmarti avatar May 14 '18 08:05 chrmarti

@chrmarti Agree..

jdneo avatar May 14 '18 10:05 jdneo

I was able to repro this, simply by leaving VS Code open for ~an hour without interacting with it.

derek1ee avatar Sep 20 '18 00:09 derek1ee

We are experiencing the same issue. Do you guys know if it has been fixed?

su-jie avatar Feb 27 '19 07:02 su-jie

No, https://github.com/AzureAD/azure-activedirectory-library-for-nodejs/issues/197 should be reopened from what I see.

chrmarti avatar Feb 27 '19 10:02 chrmarti

Any idea on the right person/team to contact about getting this fixed?

fiveisprime avatar Apr 03 '19 22:04 fiveisprime

@navyasric closed the upstream issue (AzureAD/azure-activedirectory-library-for-nodejs#197), maybe we can reach out to her.

chrmarti avatar Apr 04 '19 09:04 chrmarti

Still encountering this issue...

gi-joe-moto avatar Aug 14 '19 18:08 gi-joe-moto

any one can help for this issue ?

ms-guizha avatar Aug 14 '19 20:08 ms-guizha

Upstream is unresponsive. We could look into shipping a patched version, but we also want to look into moving to MSAL (replacing ADAL that shows the problem).

chrmarti avatar Aug 15 '19 09:08 chrmarti

If anyone is still encountering this issue, I found that deleting the slsTokenCache worked for me:

rm ~/.azure/slsTokenCache.json

https://github.com/serverless/serverless-azure-functions/issues/412#issuecomment-591511201

e-compton avatar Mar 03 '20 15:03 e-compton

What an ever-green issue. ~100 mentions! Let me contribute to it as well.

I'm occasionally seeing this error when for some reason the token cache (maintained by adal-node library) contains two valid tokens with the same resource value: image

This makes _loadSingleEntryFromCache() method produce an error as shown on the screenshot, which is then converted into an Entry not found in cache failure: image

I don't know which chain of events leads to a token being duplicated in the cache. I also don't know why adal-node treats this condition as a failure.

Restarting vscode seems to help.

adal-node v0.2.3 ms-vscode.azure-account-0.9.11

scale-tone avatar Nov 14 '21 22:11 scale-tone

I don't know which chain of events leads to a token being duplicated in the cache

No, wait, I know! It's a concurrency issue. Token cache (or some code that uses it) doesn't tolerate parallel async calls, that use the same kind of token. In my case the solution was to always make all network calls sequentially. But there're always chances for unrelated calls to interfere with each other like that, so this is definitely a bug on the token cache side.

scale-tone avatar Nov 15 '21 14:11 scale-tone

Unfortunately this has been an issue with ADAL for a while. We're onboarding support for Microsoft's new authentication library: MSAL (tracking in https://github.com/microsoft/vscode-azure-account/issues/203) which will likely fix this issue. And if not - at least MSAL is actively maintained and we can request changes from the MSAL team.

wwlorey avatar Nov 15 '21 18:11 wwlorey