SFTtech / openage

Free (as in freedom) open source clone of the Age of Empires II engine 🚀
http://openage.dev
Other
12.6k stars 1.11k forks source link

Failed to add inotify watch for some asset. #260

Open dbrgn opened 9 years ago

dbrgn commented 9 years ago

Trying to build the debug build on Arch Linux. When starting:

$ make run
...
DBG Texture has been loaded from assets/converted/Data/graphics.drs/4015.slp.png
INFO Loading meta file: assets/converted/Data/graphics.drs/4015.slp.docx
 ERR Error: WARN cpp/assetmanager.cpp:62 (std::shared_ptr<Texture> openage::AssetManager::load_texture(const std::string &), thread 0): Failed to add inotify watch for assets/converted/Data/graphics.drs/4015.slp.png
INFO cleanup container
CRIT Exception: Error: WARN cpp/assetmanager.cpp:62 (std::shared_ptr<Texture> openage::AssetManager::load_texture(const std::string &), thread 0): Failed to add inotify watch for assets/converted/Data/graphics.drs/4015.slp.png
Makefile:46: recipe for target 'run' failed
make: *** [run] Error 1

Any ideas?

(Would be great if I could get it to run, we'll probably do a small openage dev hackathon in Switzerland in 2 weeks.)

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

TheJJ commented 9 years ago

i'd probably reconfigure without inotify support for a quick fix. I can imagine that your kernel doesn't want to give you any more notification handles.

Just run ./configure $whateverargsyouhad --without-inotify to disable it.

Hackathon? Awesome :grin:

Are you in our IRC already? If not, worth it.

franciscod commented 9 years ago

I had no problems on Arch Linux... hmm

are the permissions on the asset directory ok? (644 for files, 755 for dirs should work)

wheeee! hackaton! :dancer:

dbrgn commented 9 years ago

i'd probably reconfigure without inotify support for a quick fix. I can imagine that your kernel doesn't want to give you any more notification handles.

Thanks, I'll try that workaround.

Hackathon? Awesome :grin:

Yeah, we're some guys from https://www.coredump.ch/ hackerspace and might use some of the time at https://npl.ch/ LAN party to work on developing games instead of playing games ;)

Are you in our IRC already? If not, worth it.

I'll join and idle around a bit :)

mic-e commented 9 years ago

Did the fix work? Any idea why the inotify watch might be failing (file doesn't exist, kernel limitations, ...)?

dbrgn commented 9 years ago

Tried it this morning. Yep, now it starts.

The file does exist and can be opened using an image viewer. I'll do more to debug this today. I also suspect kernel limits.

dbrgn commented 9 years ago

My current inotify watch limit:

$ cat /proc/sys/fs/inotify/max_user_watches
8192

I tried to temporarily increase the limit:

$ sudo sysctl fs.inotify.max_user_watches=32000
fs.inotify.max_user_watches = 32000
$ cat /proc/sys/fs/inotify/max_user_watches
32000

Now the game data loads properly.

Are you currently watching every resource file? Would it be possible to only monitor the directories for change instead?

PS: The parameter appeared to be --without inotify, not --without-inotify.

TheJJ commented 9 years ago

My limit is 8192 as well, and it works for me. Strange. This means that we should optimize the watches though, e.g. by watching folders or by other means.

dbrgn commented 9 years ago

Using this technique, it looks like openage is creating 1804 inotify watches. Not that much.

I'm also running other tools that might use watches though, like Dropbox and Spotify.

mic-e commented 9 years ago

Independent of any advanced solutions, we definitely should make the watching failure non-fatal. Just print a warning message and be done with it.

TheJJ commented 9 years ago

We should just replace inotify by fanotify, but this is a task for #264.