-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
On Linux file watchers are a limited resource with some arbitrary (system config dependent!) fixed limit.
If there are no more file watchers left, dart analyze can hang forever.
The problem is that analyzer code in context_manager.dart assumes a watcher failure is temporary and tries again, but it will not succeed until more watchers become available. So, it needs to give up at some point.
The permanent failure can be identified by the error message, "(OS Error: No space left on device, errno = 28)", yes, Linux reports "not enough watchers" as "no space left", which has been confusing people for a very long time :)
To repro, first exhaust your file watchers. This is system dependent, on mine I can do
sudo sysctl -w fs.inotify.max_user_watches=0
to set the max number of watchers to zero.
Then, running
dart analyze lib pubspec.yaml
hangs. (Other invocations don't hang, not sure exactly why, I guess a different number of watchers is created).
The number of watches should reset on reboot, or you can change it back, on my system the old value was about 4000000
sudo sysctl -w fs.inotify.max_user_watches=4000000