非人権環境で発生。 ```txt fswatch: inotify(7) limit reached, see :h fswatch-limitations for more info. ``` ````markdown fswatch-limitations When on Linux and using fswatch, you may need to increase the maximum number of `inotify` watches and queued events as the default limit can be too low. To increase the limit, run ```sh sysctl fs.inotify.max_user_watches=100000 sysctl fs.inotify.max_queued_events=100000 ``` This will increase the limit to 100000 watches and queued events. These lines can be added to `/etc/sysctl.conf` to make the changes persistent. ```` 確認する。 おそらくこれが非人権環境のデフォルト値。 ```shell ❯ sudo sysctl fs.inotify.max_user_watches fs.inotify.max_user_watches = 524288 ❯ sudo sysctl fs.inotify.max_queued_events fs.inotify.max_queued_events = 16384 ``` 人権環境のデフォルト値はこれ。 ```shell ❯ sudo sysctl fs.inotify.max_user_watches fs.inotify.max_user_watches = 524288 ❯ sudo sysctl fs.inotify.max_queued_events fs.inotify.max_queued_events = 16384 ``` 値を増減することで何が起きるかわからない。 エラーが出なくなればそれでいいので、非人権環境の方で敷居値を下げてやれば良いのかもしれない。 [inotify(7) - Linux manual page](https://www.man7.org/linux/man-pages/man7/inotify.7.html) とりあえずmanを見る。変な位置の改行がある。💩 [[2024年05月09日]] 続き。 とりあえず1に設定する。 ```shell sudo sysctl fs.inotify.max_user_watches=1 sudo sysctl fs.inotify.max_queued_events=1 ``` そうするとこのようなエラーが出てきた。 1に設定してはダメらしい。 ```txt fswatch: inotify_add_watch: No space left on device ``` [systemctlコマンドで "No space left on device" が表示されるけどdfでは余裕があるナゾ - 赤帽エンジニアブログ](https://rheb.hatenablog.com/entry/inotify) inotify の上限はシステムのメモリから自動的に計算されるらしい・・・ 記事によると > inotify watchが不足する場合、単純に fs.inotify.max_user_watches の値を大きくすることで対応します。 設定変更自体でメモリ消費等が増えることはなく、実際にinotify watchが利用された場合にだけ消費されます。 とのことなので5000兆を設定してもマシンが爆発、はしなさそう。 ```shell sudo sysctl fs.inotify.max_user_watches=100000 sudo sysctl fs.inotify.max_queued_events=100000 ``` 例示されている通り10万に設定してみる。 ただネット検索に `inotify watch メモリ不足` というサジェストがあるので、そもそもエラー自体消去してしまったほうがいいのかもしれない。 人権では発生しないので非人権固有の問題。