Commit 7906eb5
committed
fix bug where we were unwatching everything but 256 files, instead of just unwatching 256 files
Unwatching occurs when we hit the syscall.EMFILE error ("too many open files"),
and we need to unwatch so that we have some file descriptors available for
starting commands i.e. cmd.Start(). On macOS, creating a timer for debouncing
already consumes a file descriptor [1], and if there are no file descriptors
available it panics with a very intimidating stack trace.
[1] https://dzone.com/articles/go-servers-understanding-epoll-kqueue-netpoll#:~:text=kqueue%20is%20a%20similar%20mechanism%2C%20where%20registered%20events%20(read/write%2C%20timers%2C%20signals%2C%20files)%20are%20handled%20via%20kevent1 parent f3bb5ed commit 7906eb5
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
663 | 663 | | |
664 | 664 | | |
665 | 665 | | |
666 | | - | |
| 666 | + | |
667 | 667 | | |
668 | 668 | | |
669 | 669 | | |
| |||
692 | 692 | | |
693 | 693 | | |
694 | 694 | | |
695 | | - | |
| 695 | + | |
696 | 696 | | |
697 | 697 | | |
698 | 698 | | |
| |||
0 commit comments