-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
-
Your Windows build number: (Type
ver
at a Windows Command Prompt)
Microsoft Windows [Version 10.0.18898.1000]
-
What you're doing and what's happening:
My setup:
- Mount location is changed from
/mnt
to/
, so for exampleC:\Users
is at/c/Users
- I have a directory containing source code for various projects under
C:\Users\account\dev
- I have a symlink from
/c/Users/account/dev
to/home/account/dev
- I edit files under
~/dev
with editors in Windows, but run tests/servers/etc under WSL
Please note that I am not attempting to edit files under the WSL filesystem from windows; I am editing files in the Windows filesystem from windows and then accessing them from within WSL.
The specific problem I'm posting about is that occasionally when I'm editing files in IntelliJ, the content of the files will stop changing when viewed from WSL. This only started happening with the latest fast ring updates. I haven't noticed this happening with files edited by things other than IntelliJ, but around the latest update I switched to editing python/js with VS Code's remote WSL extension, so that could be a red herring.
If I restart LxssManager or reboot the computer, this is fixed for a while. I have not been able to identify anything specific that triggers this.
Another ongoing issue (which is not a WSL issue) is that editing files with IntelliJ resets their permissions to whatever the mask for the mounted drive is is. I assume (but have not confirmed) this is because IntelliJ writes to files by deleting and recreating them. This could be why only files edited in IntelliJ exhibit this problem.
The file content is the same no matter what method I use to open it (meaning git, with a WSL-side editor like vim, with cat, the binaries built by maven, etc).
- What's wrong / what should be happening instead:
Changes made to files inC:\Users\account\dev
on Windows should be reflected immediately on/c/Users/account/dev
in WSL..
Activity
craigloewen-msft commentedon Jun 4, 2019
Hi @pmsanford , could you provide more of a repro? Is there a specific way that the changes stop being noticed in WSL? As in, are you already running a server on these files and the changes aren't going over to WSL while the server is running (and if so, which server?), or are you not seeing the changes using commands like
cat
, etc.Any more description, or list of command line arguments you use would be helpful!
Thanks!
pmsanford commentedon Jun 4, 2019
@mscraigloewen Unfortunately I haven't been able to notice a specific set of steps (other than editing in IntelliJ as mentioned before) as the way this manifests is usually fairly confusing and I don't notice until I've made other changes troubleshooting. This has only happened 4 or 5 times so far.
This occurs in a Java project I'm working on, so the usual way I discover it is that I'll make some changes (in IntelliJ on Windows), rebuild the project (on WSL), run it (on WSL), and the changes I've made will not be reflected in the output of the program. I'll then go back to the IDE (running in Windows) and check that the changes are present and saved; I can view them with something like Notepad, VS Code (also running in Windows), or Get-Content in PowerShell and the changes are reflected there as well. If I view them using anything on the WSL side (cat, vim, etc) the content does not match what I see from apps on the Windows side (it reflects the content from before my edits). Restarting LxssManager (or my entire PC) fixes this and they sync up again.
I haven't seen this since the last fast ring update (
18908.1000
) but I've also been on PTO. Will update if this happens again and try to nail down more specifically what I was doing before it happened.craigloewen-msft commentedon Jun 4, 2019
Okay great! Anything reproducible that we could quickly test would be helpful. In the meantime I'll try out your setup and see if I can repro. Please ping this thread if you have any updates!
pmsanford commentedon Jun 7, 2019
This happened again today - I had been editing the same Java project with VS Code Insiders using the WSL Remote extension and I switched to IntelliJ editing by local file path and some of the first changes I made caused a desync. I didn't do anything special - I edited a test file and saved and they went out of sync. I realized I didn't post my wsl.conf in the initial post:
and my current ver:
Microsoft Windows [Version 10.0.18908.1000]
ETA: This initially started happening before the vs code remote extensions were released - I don't think that's related.
craigloewen-msft commentedon Jun 7, 2019
Yup I was able to repro your problem! Here's the steps I used:
cat ./test.c
gives the earlier version of the fileWe'll take a look at this bug! Thanks for posting the issue.
@SvenGroot
canselcik commentedon Jun 11, 2019
I am having this issue as well. It is a recent regression as far as I can tell from my timeline.
Calling
sync; sync
in WSL seemed to have taken care of if at least once, but it keeps coming back and at this point it doesn't sync using that workaround either. So that was probably a coincidence.Looks like IntelliJ is able to know that the
write
failed, however the reason isn't displayed. This might have something to do with the use ofinotify
inside WSL because as far as I can tell, if the program usinginotify
inside WSL is terminated, and the file is edited again in Windows, the write succeeds and the files in question go in sync.19 remaining items
fredlebel commentedon Sep 17, 2020
Encountered this issue and in my case it was
ng serve
under WSL preventing WSL from syncing with Windows under/mnt/c/...
. Seems related to inotify API which is probably used by Angular for code change detection and automatic rebuild.Just killing the
ng serve
process fixed the problem and previous changes done in Windows were immediately visible in WSL.m-7761 commentedon Sep 17, 2020
Is
ng serve
orinotify
a first-party component of WSL or is it just regular software that happens to be triggering something in WSL to fail? This bug makes vscode unusable with WSL projects. If you can see a path forward it would be helpful to notify the authorities.xmnboy commentedon Oct 25, 2020
Confirmation that I am seeing the same problem that @dstarkebaum described above. VSCode on WSL is causing my WSL environment to not see changes made on the Windows side of the fence. Both sides are operating on files that are managed by the Windows file system (e.g.,
C:\Users\paul\Desktop\temp.txt
on the Windows side and/mnt/c/Users/paul/Desktop/temp.sh
on the WSL side.p.s. Current Windows 10 system as of date of this post. No special dev releases. Happens with both WSL1 and WSL2. Ubuntu WSL distributions.
wiliamwalace commentedon Nov 23, 2020
Same problem, in my case it is pptx files edited with Powerpoint that are not synchronized. I was able to reproduce the problem described by @dstarkebaum with Excel and I had another finding. During the reproduction test, I parallelly edited another text file with Notepad, and the Notepad modifications were correctly reflected, no matter VS Code with remote extension was running or not. It seems a conflict between certain Microsoft software.
hzhangxyz commentedon Dec 14, 2020
Same here, it seems this issue happend when I open both of vs and vscode, after I close vscode and save file again in vs, the file sync
Scytmo commentedon Dec 14, 2020
There is a work-around in VSCode that I have found effective. If I enable the setting "Remote.WSL > File Watcher: Polling", then VSCode polls for file changes rather than using file change events from the operating system (which I believe is what causes the problem). With this option enabled, I don't suffer from the problem any more.
Obviously, this is only a useful work-around for those people who are suffering from this problem only due to VSCode - some people appear to be reporting problems due to other programs that are causing the same problem due to the use of file change events.
rekire commentedon May 22, 2021
I just observed the same behavior while using Visual Studio code.
On the wsl bash I see this:
On windows cmd:
Very strange to see that
After I closed all wsl instances it started working again as expected
rcmosher commentedon Jul 26, 2021
I was able to get my file contents back up to date running
wsl.exe --shutdown
. Probably unmounting and remounting my Windows directory from WSL would have also done it.I'm not sure what caused this. I'm also running
ng serve
, but also did a number of git branch switches (from Windows) in between creating these files in WSL and them disappearing.drzow commentedon Sep 20, 2021
I'll have to throw a Me To in here! Lost a fair deal of work due to changes getting overwritten with an older version of the file. Here's my setup:
ver: Microsoft Windows [Version 10.0.22000.194] (I guess that string hasn't been bumped to 11 yet)
VSCode 1.60.0 running Remote Connection to WSL2 (Kernel version: 5.10.43)
I was accessing my project on OneDrive through WSL2 (so /mnt/c/Users/user/OneDrive/Project) which was working fine until I got a first cut done and moved the project into git -- that's when I started noticing problems. Okay, running git on WSL2 on OneDrive -- I get how that might be too many levels of indirection, so I moved the repository to be local on WSL2 (/home/user/Project) and still had problems, so I pulled the files out of git, still running local to WSL2 (/home/user/ProjectNoGit) and I am in a state where I vi the file in WSL2, make a change, save-and-quit, then less the same file and I do not see my change that I just made in vi.
When I quit VS Code (with the remote connection), I could not repo, and when I try @Scytmo's recommendation to turn on polling (which is supposed to be for WSL1 but seems to help here as well) so it's like VS Code's Remote Connection (probably something with the file watcher) is keeping the old copy of the file open and sometimes WSL is reading the new one, and sometimes the old one. It may well be that I had this problem all along, but the addition of git exaggerated it to the point I noticed it? 🤷
microsoft-github-policy-service commentedon Feb 1, 2024
This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.
Thank you!
rekire commentedon Feb 3, 2024
This bug is still there. Something is changing the line endings transparently.