Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
stack build --file-watch fails sometimes #1838
removeWatch: invalid argument (Invalid argument) Type help for available commands. Press enter to force a rebuild.
The solution is to restart stack. This seems to have appeared since upgrading to 1.0.4.
$ stack --version Version 1.0.4, Git revision cf18703b1392a96a5a4896a560309e501af63260 (3220 commits) x86_64 $ uname -a Linux ip-172-31-43-180 3.13.0-79-generic #123-Ubuntu SMP Fri Feb 19 14:27:58 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
I've also encountered this, but only after hours of usage. I haven't investigated it yet. I've dug into the related code a bit, though:
We're using the high level fsnotify watchDir function from fileWatch, so I think that the issue is either there or the hinotify package it uses on linux. Here's the definition of removeWatch in hinotify:
removeWatch :: WatchDescriptor -> IO () removeWatch (WatchDescriptor (INotify _ fd _ _ _) wd) = do _ <- throwErrnoIfMinus1 "removeWatch" $ c_inotify_rm_watch (fromIntegral fd) wd return ()
So, when the c function returns an exit code, it throws an invalid argument exception. This can happen in the following cases (from here):
I'm not sure why this would happen. Maybe it's sufficient to catch the exception?
@mgsloan good info!
@mgsloan Another interesting thing I noticed is that running