JVM file watchers don't work
Please use the following bug reporting template to help produce actionable and reproducible issues. Please try to ensure that the reproduction is minimal so that the team can go through more bugs!
- A brief description
It appears that the file watcher system mechanisms that Java takes advantage of are broken in WSL. This comes up when I try to use the Clojure's figwheel tool for watching ClojureScript files for changes, recompiling, and updating the UI.
- Expected results
Figwheel should work and not fail when I try to run it.
- Actual results (with terminal output if applicable)
Downloads required packages, and goes through initial build, but then fails when it tries to start watching files.
- Your Windows build number
14393.447
- Steps / All commands required to reproduce the error from a brand new installation
# setup a figwheel project and try to start fighweel
lein new re-frame someproject
cd someproject
lein figwheel dev
- Strace of the failing command
sun.nio.fs.UnixException: Bad file descriptor
at sun.nio.fs.UnixNativeDispatcher.read(Native Method)
at sun.nio.fs.LinuxWatchService$Poller.run(LinuxWatchService.java:318)
at java.lang.Thread.run(Thread.java:745)
- Required packages and commands to install
#install lein...
sudo apt-get install somejdk...
wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein -O ~/bin
chmod +x ~/bin/lein
See our contributing instructions for assistance.
Side note: This particular issue came up on #277, though the main point of that issue was more general.
@metasoarous , thanks for noticing this! You've actually posted a stack trace, not an strace (strace is a Linux command that traces application system calls), but if I had to guess, I would expect an strace to indicate that Java is using Linux's inotify subsystem to implement file watchers.
inotify support in WSL is tracked by #216 and should be fully resolved as of Build 14942, which is available through the Insider program. If you're willing to try out a recent Insider build, it would be great to know if this problem has been fixed.
Thanks @aseering ! @metasoarous I was able to run lein with no issues on the latest Insider build, please give it a try if possible.
Great to hear! Thank you. I'll try that out.
@aseering I tried out build 14965 and I can confirm it has fixed the Java issue sun.nio.fs.UnixException: Bad file descriptor. Thank you!