WSL icon indicating copy to clipboard operation
WSL copied to clipboard

Unable to save file when inotify is in use (using Node)

Open raphaeltm opened this issue 9 years ago • 29 comments

I'm building a React app using "Create React App." When the development server is running and I try to modify a file, it seems to be locked. My IDE returns an error message. To be clear, I'm running the app in the Windows filesystem /mnt/c/etc....

Your Windows build number:
Microsoft Windows [Version 10.0.15063]

What you're doing and what's happening: I ran npm run start and everything seems to work properly initially...

What's wrong / what should be happening instead: The server runs as expected, and given the changes in the Windows Creators Update, I expected the automatic reload to work. Here is what I experience when I try to save a file in JetBrains' WebStorm:

image

I'm not sure how to get more information about the error.

raphaeltm avatar Apr 20 '17 06:04 raphaeltm

A couple of days have passed and no one has jumped in on this one. If I had to venture you are looking at a manifestation of #1535 #966 and friends. Keep an eye on 966 and if the status flips to 'better now' try again and see if that helps.

therealkenc avatar Apr 22 '17 02:04 therealkenc

Adding @JasonLinMS to see if he could help with the iNotify pieces.

sunilmut avatar Apr 22 '17 04:04 sunilmut

I did try out this scenario in 15063 using Webstorm, and I was able to save files being watched by the server. (See screenshot, the save was successful in a /mnt/c location and the server reloaded.)

We do have a similar issue where files being watched by inotify were unable to be deleted properly, which could be what your editor is doing. This issue was fixed in Insider Build 16184, and we are working towards getting the fix backported into the Creators Update 15063. Is there any chance you can try out the Insider Builds?

image

JasonLinMS avatar May 02 '17 21:05 JasonLinMS

I ran into this exact issue using create-react-app and I think I was able to narrow it down to the scenario when the files are being edited from bash.exe, e.g. using vim. If I edit them with VS Code, everything works fine and the files are watched correctly too. I'm using WIndows 10 1703, compilation 15063.332.

stasm avatar Jun 12 '17 19:06 stasm

Running into this issue with PHPStorm and Webpack --watch. Permission denied when trying to save. Win 10, 1703 Build 15063.674

realspqrk avatar Oct 18 '17 07:10 realspqrk

I was getting this with webpack watch too, it works if you disable "safe write" in settings: image It seems as though WSL has some problems when watched files are deleted from windows.

KaelWD avatar Oct 22 '17 07:10 KaelWD

Actually I think it was fixed in 1709 Build 16299.19, at least on my machine using Webpack and PHPStorm

realspqrk avatar Oct 23 '17 15:10 realspqrk

The release notes for 16184 say

Fixed issue where deleting DrvFs files with open handles will cause the file to exhibit undefined behavior [GH 544,966,1357,1535,1615]

#1535 was marked as a dupe of #966, although no one has stated explicitly (that I've seen) whether the inotify() problem is the same as the unlink() problem, or whether inotify() is just a mischaracterisation of the root issue. But either way, Jason did say this was addressed back in May, so this issue should probably be duped in with the rest. I think it is safe to say it was never backported to Spring Creators Update, but you should be golden on FCU.

therealkenc avatar Oct 23 '17 17:10 therealkenc

@ptmr-io I was still on 16299.15, I just updated to .19 and it's still happening.

image

It's still visible in explorer too: image

But I can't open it; image

When I kill webpack-dev-server the file disappears: 2017-10-25_02-57-26

Deleting it with rm works just fine on the other hand: image

KaelWD avatar Oct 24 '17 15:10 KaelWD

well, a bit too early. It happens again with webpack --watch and PhpStorm.

realspqrk avatar Nov 07 '17 16:11 realspqrk

Same issue here. Win 10 - Fall creators update, WebStorm 17.3

doublemcz avatar Dec 19 '17 07:12 doublemcz

Ok, guys. Wake up and look again to this thread. Using Windows 1709 Build 16299.192 and having same behaviour. While watching files with inotifywait command

In my case

inotifywait -m -q -r -e CREATE,CLOSE_WRITE,DELETE,MODIFY,MOVED_FROM,MOVED_TO --exclude '___jb_|/\.' --format '%w%f' .

but not relevant occasionally (not always) files get locked, and I cannot do some git merges from Windows, getting error: Merge: cannot stat 'src/FVS/ClientBundle/Service/Data': Permission denied

r0ssIV avatar Jan 19 '18 07:01 r0ssIV

After stopping inotifywait evrth goes fine.

r0ssIV avatar Jan 19 '18 07:01 r0ssIV

And one more - it's ot only in Windows GIT. When running in WSL bash 'git merge origin/master' getting same error, so it happens INSIDE WSL bash

r0ssIV avatar Jan 19 '18 07:01 r0ssIV

Any progress on this?

alexiuscrow avatar Jul 12 '18 18:07 alexiuscrow

Got the same kind of problem with webpack watched files when working on them with Sublime Text or Smartgit. It's the only thing preventing me from using WSL for node dev instead of Powershell...

SBRK avatar Aug 28 '18 12:08 SBRK

Didn't solve it until now?

SvenZhao avatar Jan 08 '19 03:01 SvenZhao

Exactly the same issue with Webstorm, Ionic and Ubuntu subsystem. Still no solution?

flokixdev avatar Jan 20 '19 21:01 flokixdev

Please could this be prioritized? It seriously breaks / hampers doing any react / webpack web development with WSL.

tuomastanner avatar Feb 07 '19 13:02 tuomastanner

Any solution? actual problem for fsnotifier in phpstorm

xeurun avatar Feb 21 '19 08:02 xeurun