vscode: error logging in 'writing login information to the keychain failed with error 'not enough memory resources are available to process this command'

Does this issue occur when all extensions are disabled?: Yes/No unable to start container without extensions enabled

  • VS Code Version:
  • Version: 1.60.0-insider (user setup) Commit: 9dd4f31a21d63deea5e1fc322cfc802413b31d95 Date: 2021-08-16T05:21:19.431Z Electron: 13.1.8 Chrome: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Windows_NT x64 10.0.22000
  • OS Version:

Steps to Reproduce:

VSCode Insiders Edition on Windows Insider gives error every time when logging in to GitHub and other sites 'writing login information to the keychain failed with error ‘not enough memory resources are available to process this command’. Also, have set up ssh, but still requires web authentication for extensions every time I open VSCode. It gives the error, but then continues to login after the error and does not save login information. after opening VSCode insiders

  1. click login to github
  2. displays error and does not save login information
  3. then tested on current VSCode and doesn’t require login every time and no issues with memory (working) Version: 1.59.0 (system setup) Commit: 379476f0e13988d90fab105c5c19e7abc8b1dea8 Date: 2021-08-04T23:13:12.822Z Electron: 13.1.7 Chrome: 91.0.4472.124 Node.js: 14.16.0 V8: 9.1.269.36-electron.0 OS: Windows_NT x64 10.0.22000

Regular Edition does not give the error and I do not have to login to github everytime the app starts. https://www.loom.com/share/b7b2411e8c3147a88b2fec7e1eaa03f3

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 7
  • Comments: 95 (35 by maintainers)

Commits related to this issue

Most upvoted comments

Just want to report that on Windows, the keychain could get into a bad state due to this issue, after which even upgrading to the newer version of vscode doesn’t help’. One would need to take the actions suggested in https 😕/code.visualstudio.com/docs/editor/settings-sync#_troubleshooting-keychain-issues, as mentioned above, which solved the issue for me.

对于那些已经清除了凭证管理器中的大量凭证的人……你能检查一下这个数字是否再次增加了吗?

我怀疑你们中的一些人在我对这个空间进行重大更改的时候陷入了糟糕的状态…但现在已经解决了,vscode 的代码不再污染 cred 存储…这即将到来尽管我已经尝试了很多方法来解决这个问题,但我没有重现这个问题。

话虽如此,如果用户使用其他使用钥匙串的应用程序(如 Adob​​e 产品中提到的那样),用户仍然可能会进入这种不良状态。对于这种情况,我们至少应该在此处的钥匙串问题故障排除中包含文档:https 😕/code.visualstudio.com/docs/editor/settings-sync#_troubleshooting-keychain-issues

cmdkey /list | Select-String -Pattern "LegacyGeneric:target=(vscode.+)" | ForEach-Object { cmdkey.exe /delete $_.Matches.Groups[1].Value }

this is useful!

This issue doesn’t look the same as #177556, but I’ll wait for 1.77 and reopen my bug report if the issue is not fixed.

For the folks that have cleared the large list of credentials in their credential manager… can you please check to see if that number is increasing again?

My suspicion is that some of you got into a bad state around the time that I was making heavy changes in this space… but now that that has settled, vscode’s code isn’t polluting the cred store anymore… This is coming from my lack of reproduction of the issue even though I’ve tried numerous ways to do it.

With that said, users could still get into this bad state though, if they use other applications that use the keychain (like someone mentioned with Adobe products). For this case, we should at the very least include docs in the troubleshooting keychain issues here: https://code.visualstudio.com/docs/editor/settings-sync#_troubleshooting-keychain-issues

cmdkey /list | Select-String -Pattern "LegacyGeneric:target=(vscode.+)" | ForEach-Object { cmdkey.exe /delete $_.Matches.Groups[1].Value }

I had the same issue - too many credentials (Windows 11: Start > Credential Manager > Windows Credentials). Mine included an obscene number of vscode entries, as noted above, so I deleted them all with a powershell line I cobbled together through Google:

for /F "tokens=1,2 delims= " %%G in ('cmdkey /list ^| findstr vscode') do cmdkey /delete %%H.

It still threw the error so I hand-pruned most of the remaining entries and it took.

Good luck!

(FWIW, Win 11, 8GB RAM + 24GB Page File) image

I solved this by changing my pagefile settings by doing: System Properties -> Advanced -> Performance -> Advanced -> Virtual Memory -> Change -> uncheck ‘Automatically manage paging file size for all drives’ -> check ‘System managed size’ -> OK -> Reboot

edit: I’m not sure why the pagefile would affect it though. I have 128GB of RAM.

@TylerLeonhardt it is actually worse now. I am being asked to select the account to sync settings from repeatedly upon launching VS Code. The Microsoft accont I am using appears as “(Signed in)”, so the token does not appear to be lost, just disacossiated. I can’t see anything within the logs.

Is it worse or did your Windows credentials just get full? That happens to me from time-to-time and it’s annoying. This comment posted above provided a recipe for deleting all of the Windows credentials. This fixes it for a while, then I have to do it again.

@TylerLeonhardt I was able to reproduce on my PC with 1.76-insiders then before update and it “spammed” credentials.

After cleaning up credentials, updating, cleaning up again - 12+ days without issues. I think I was asked once (it might been for GHPR extension), but there is definitely no “spam” in credentials so far. However, it took noticeable time to repro it in 1.76-insiders so hard to tell for sure

I haven’t seen this problem for about a week on Insiders build, after several attempts to remove all credentials manually or with script. Problem re-emerged few times, but works as expected after another run of the script.

Hope update would fix it for everyone and it won’t re-emerge again.

P.S. I haven’t use a lot of workspaces lately (as mentioned in PR), will try to get into bad state before update once again.

My change hasn’t gone in yet 😅

Not sure related or not, but the latest version would cause lsass.exe consuming high CPU, especially when VS Code thinks I need to re-log in my account.

Thanks for the update. We’ll be doing more drastic work in this space this month and next and my hope is that this will be resolved then.

can you tell me how many things you’ve logged into with your Microsoft account? Based on 2 items being updated on Nov 4, I am going to guess…2… LiveShare & Settings Sync maybe?

Yes, these two.

Do you recall having to randomly sign in to Microsoft every once in a while?

It’s not that this doesn’t happen, but it is diffucult to remember so far back.

I have confirmed that once there are too many credentials, the Windows call CredWrite fails with ERROR_NOT_ENOUGH_MEMORY. This issue doesn’t have to do with Electron or Node.

cmdkey /list | Select-String -Pattern "Target: LegacyGeneric:target=(vscode.+)" | ForEach-Object { cmdkey.exe /delete $_.Matches.Groups[1].Value }
    

NOTE: THIS IS AN OLD QUOTE. LOOK AT THE NEW LINE HERE

“Target” is localized. Need to chcp 437 first. I now clear my credentials and will try to reproduce.

Hi Tyler, I have not had any failures along the lines of the original problem (needing to login each time vscode is started) since I cleared the credentials back in July. Today, I see only about 5 hits from the cmdkey command you posted. And I think I saw about the same number when I checked at some point between July and now. I tend to agree with your suspicion.

@karl-lunarg thanks for giving that a try. The content of microsoft-authentication is different than GitHub. It has a different secret storage schema (that I could get into … but lets call it as it is “legacy reasons”)

Anyway, the fact that the script I suggested worked fine, but VS Code fails leads me to believe that this might have something to do with Electron and how keytar is loaded into that.

Let me chat with @deepak1556 on this to see if he has anything thoughts

I can try this tomorrow.