-
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
Adopt atomic write for user data #180695
Comments
@Maheraj1 When this happens can you please check if the profiles folders do exist in the following location?
Can you please share @bpasero I store profiles information in the storage file. It could happen that this file is truncated? |
@sandy081 yes, this call (and any other of these) can lead to a corrupt state file if for example the process terminates after the vscode/src/vs/platform/state/node/stateService.ts Lines 140 to 146 in 66e8ef9
For a more robust state location, we have the SQLite backend. |
Unfortunately, I cannot use the StorageService because, profiles are initialised before storage service is ready and storage service is not available in CLI and Server. |
I think the state service should write to a file in the same folder ( |
Do we have confirmation this happened here? Because I still see the "info-needed" label. |
This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines. Happy Coding! |
@bpasero Reopening this and I think the fix you are working on is actually helpful that prevents loosing user data. |
I have #182974 for the providing part. |
#180695 adopt atomic delete for extensions
* #180695 - adopt atomic write for userdata * check if fsp has atomic write * fix tests
Reopened because of #187245 Atomic write in windows is failing sometimes and I think this is because some other processes (defender 🤔 ) might be holding the file that has to be renamed. I have seen similar issues in extensions when I implemented atomic installation of extensions long time back, ie. extracting the zip to a temp file in the same folder and renaming it. I have to retry renaming multiple times to avoid this. Check this issue - nodejs/node#29481 This is common in windows and it seems the workaround is to retry. |
This is a good catch and I had to learn that I think this was a decision sometime in the project to not wait for up to 60 seconds for an unrecoverable error to bubble up. But in our case with explicit atomic write support, we need to implement this retry logic from our usage I think. |
Fyi #188899 landed and will retry |
I will adopt this in debt week of September. |
This bug has been fixed in the latest release of VS Code Insiders! @Maheraj1, you can help us out by commenting If things still don't seem right, please ensure you're on version e073d67 of Insiders (today's or later - you can use Happy Coding! |
Does this issue occur when all extensions are disabled?: Yes
I was working on one of my projects when there was a power outage, I noticed that my profiles were gone. I recreated them and again a few days ago this happened again. This happened 2 times to me within a period of 2 weeks.
Steps to Reproduce:
The text was updated successfully, but these errors were encountered: