buck2 icon indicating copy to clipboard operation
buck2 copied to clipboard

[build Error initializing DaemonStateData] how to fix it

Open kris-himax opened this issue 2 years ago • 5 comments

Hi,

I want to use executorch to build the example by buck2, but face the issue like it.

So I try the hello_world project, and face the same build error.

How could I fix it?

Screenshot from 2023-10-31 14-48-26

OS: Linux Ubuntu 20.04.4 LTS x86_64 buck2 version: 2023-07-18 (buck2-x86_64-unknown-linux-musl.zst )

Thanks, Kris

kris-himax avatar Oct 31 '23 06:10 kris-himax

I add the sudo and it can build success. Screenshot from 2023-10-31 16-45-49

kris-himax avatar Oct 31 '23 08:10 kris-himax

Hi,

How can I want to do buck2 build without using sudo at command?

Thanks, Kris

kris-himax avatar Nov 01 '23 07:11 kris-himax

This sounds a bit like this issue, or at least the error message is the same. Are you using inotify? If so, have you tried increasing the limits as @thoughtpolice mentioned here? You shouldn't need to run buck2 with sudo

wendy728 avatar Nov 01 '23 13:11 wendy728

You'll need to increase the inotify limit (and run buck2 kill afterwards):

Our systems show (credit to inotify-watch-limits):

>sysctl fs.inotify.{max_queued_events,max_user_instances,max_user_watches}
fs.inotify.max_queued_events = 16384
fs.inotify.max_user_instances = 128
fs.inotify.max_user_watches = 8192

The 8k max_user_watches is probably too low for most repositories, causing buck2 to fail due to reaching the watch limit. Systems need to be updated to increase this limit.

# Temporarily increase for the current shell to 1M files.
sudo sysctl fs.inotify.max_user_watches=1048576

# Increase for everyone on the system to 1M files
echo fs.inotify.max_user_watches=1048576 | sudo tee -a /etc/sysctl.conf # or manually edit the sysctl.conf file.
sudo sysctl -p

Useful script to see how many files are being watched: inotify-consumers.

jhdub23 avatar Nov 02 '23 22:11 jhdub23

Internally we use the watchman file watcher, which can be set with a .buckconfig of:

[buck2]
file_watcher = watchman

That may help reduce the notification count. Upping the limits is probably a good idea anyway though.

ndmitchell avatar Nov 22 '23 15:11 ndmitchell