Skip to content

Increase fs.inotify.max_user_watches from 8192 (default) to 524288

What does this Merge Request do and why?

This MR raises the fs.inotify.max_user_watches from the default of 8192 to 524288 (which is rather random) but resolves issues observed in #1546 (closed) via:

sudo /sbin/sysctl fs.inotify.max_user_watches=524288

I spotted the following at https://gitlab.com/gitlab-org/gitlab-development-kit/-/jobs/2836183271#L4810:

Errno::ENOSPC: No space left on device - Failed to watch "/builds/gitlab-org/gitlab-development-kit/gdk/gitlab/spec/components/previews": The user limit on the total number of inotify watches was reached or the kernel failed to allocate a needed resource.

Which was confusing because The user limit on the total number of inotify watches was reached or the kernel failed to allocate a needed resource. is not the same type of error as Errno::ENOSPC: No space left on device. It appears the Errno::ENOSPC exception is being slightly misused in some parts and so leads to a confusing message.

Earlier in the logs, another error message appears:

Listen::Error::INotifyMaxWatchesExceeded: Unable to monitor directories for changes because iNotify max watches exceeded. See https://github.com/guard/listen/blob/master/README.md#increasing-the-amount-of-inotify-watchers .

Which is what lead me to investigating the fs.inotify.max_user_watches value.

Merge Request checklist

  • This change is backward compatible. If not, please include steps to communicate to our users.
  • Tests added for new functionality. If not, please raise Issue to follow-up.
  • Documentation added/updated, if needed.
  • gdk doctor test added, if needed.
  • Add the ~highlight label if this MR should be included in the CHANGELOG.md.

Closes #1546 (closed)

Edited by Ash McKenzie

Merge request reports