Search code examples
buckbuck2

Buck2 can't create inotify watchers


I'm following the getting started guide for buck2. My system is Ubuntu 22.04 (Jammy).

Installation worked with:

$ rustup install nightly-2023-05-28
cargo +nightly-2023-05-28 install --git https://github.com/facebook/buck2.git buck2
# After installation finished I get this version
$ buck2 --version
buck2 267ae15fcc862c9cd066152c8816e49f830d7715 <local>

Then I used buck2 init to create a .buckconfig containing:

[repositories]
root = .
prelude = prelude
toolchains = toolchains
none = none

[repository_aliases]
config = prelude
fbcode = none
fbsource = none
buck = none

[parser]
target_platform_detector_spec = target:root//...->prelude//platforms:default

However when I run buck2 build //..., I get the following errors:

$ buck2 build //...
Error initializing DaemonStateData

Caused by:
    0: Error creating a FileWatcher for project root `<REDACTED PROJECT ROOT PATH>`
    1: Creating notify file watcher
    2: OS file watch limit reached. about ["<REDACTED FILE>"]

Changing the inotify file watcher limit with sudo sysctl -w fs.inotify.max_user_watches=524288 (from default 65535), does not seem to do anything. I get the same error message on the same file.

It seems to be some other kind of error which is happening here, not related to the file watcher limit. Has anyone experienced this before?


Solution

  • I just ran into this issue, as well. It turns out that there is a buck2-daemon that is already running with the previous inotify setting. After changing the inotify setting, run:

    buck2 kill # Can also do: buck2 killall
    

    The next run will launch a new buck2-daemon with the new setting.