-
Notifications
You must be signed in to change notification settings - Fork 27.9k
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
Race condition in resolving workspace configuration #189138
Comments
@vaclavHala thanks for the issue, I can confirm. @sandy081 this seems to be a race condition in how the configuration service reacts to changes to the config file. There is a scheduler that reads delayed after a change:
I think what happens here is a race condition where you manage to read the file when it has been truncated to an empty file but before writing the new contents. As such you consider the workspace as empty. For this reason, we have
Here the configuration comes from a workspace file, thus scheme is likely Bottom line: all reads from configuration service should pass |
This bug has been fixed in the latest release of VS Code Insiders! @vaclavHala, you can help us out by commenting If things still don't seem right, please ensure you're on version f7973f3 of Insiders (today's or later - you can use Happy Coding! |
Should this fix be present in insiders build from rev |
@bpasero Since you were able to reproduce this, can you please confirm if it is fixed for you? |
I am not seeing this issue anymore, also @roblourens verified it. I used above steps with an untitled workspace and with a saved workspace. Does that actually make a difference for you @vaclavHala ? |
Hmm the repro steps of this issue indeed seem to pass but when I tried running my original test (from which I derived the steps and code here as smallest possible repro) using the insiders build it still sometimes fails in the part where I setup workspace. It is likely that is caused by another problem though as I'm also calling |
Sometimes in multi-folder workspace the
vscode.workspace.workspaceFolders
will return empty array even though there are some folders in the workspace.Does this issue occur when all extensions are disabled?: Yes
Version: 1.79.2
Commit: 695af09
Date: 2023-06-14T08:59:55.818Z
Electron: 22.5.7
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Linux x64 4.19.0-18-amd64
happens with latest insiders too
Operating System: Debian GNU/Linux 10 (buster)
Kernel: Linux 4.19.0-18-amd64
Architecture: x86-64
Steps to Reproduce:
Run workspace race
Sometimes the bug manifests after a few seconds, sometimes it may take up to a few minutes.
Note I'm always waiting for
vscode.workspace.onDidChangeWorkspaceFolders
to fire before touching the workspace again after any update, as demonstrated in the reproThe text was updated successfully, but these errors were encountered: