@@ -50,7 +50,12 @@ There are three kernel tuning options related to the `inotify` system:
50
50
To see the values for these settings that are applicable to your workspace, run:
51
51
52
52
``` console
53
- $ sysctl fs.inotify.{max_queued_events,max_user_instances,max_user_watches}
53
+ sysctl fs.inotify.{max_queued_events,max_user_instances,max_user_watches}
54
+ ```
55
+
56
+ You should see output similar to the following:
57
+
58
+ ``` text
54
59
fs.inotify.max_queued_events = 16384
55
60
fs.inotify.max_user_instances = 128
56
61
fs.inotify.max_user_watches = 8192
@@ -69,8 +74,9 @@ To identify the programs consuming `inotify` watches, you can use a script that
69
74
summarizes the information available in the ` /proc ` filesystem, such as
70
75
[ ` inotify-consumers ` ] .
71
76
72
- This script will show the names of programs along with the number of ` inotify `
73
- watches registered with the kernel:
77
+ Running ` ./inotify-consumers ` will show the names of programs along with the
78
+ number of ` inotify ` watches registered with the kernel, which will look like the
79
+ following:
74
80
75
81
``` console
76
82
$ ./inotify-consumers
@@ -94,7 +100,7 @@ $ ./inotify-consumers
94
100
https://github.com/fatso83/dotfiles/blob/master/utils/scripts/inotify-consumers
95
101
96
102
To see the specific files that the tools track for changes, you can use ` strace `
97
- to monitor invocations of the ` inotify_add_watch ` system call:
103
+ to monitor invocations of the ` inotify_add_watch ` system call, for example :
98
104
99
105
``` console
100
106
$ strace --follow-forks --trace=' inotify_add_watch' inotifywait --quiet test
@@ -154,7 +160,7 @@ For example, you can create a file called `/etc/sysctl.d/watches.conf` and
154
160
include the following contents:
155
161
156
162
``` text
157
- fs.inotify.max_user_watches = 65536
163
+ fs.inotify.max_user_watches = 10485760
158
164
```
159
165
160
166
Alternatively, you can use the following DaemonSet with ` kubectl apply ` :
@@ -186,10 +192,21 @@ spec:
186
192
initContainers :
187
193
- name : sysctl
188
194
image : alpine:3
195
+ env :
196
+ # Each inotify watch consumes kernel memory, and existing container memory
197
+ # limits do not account for this. While you can set an arbitrary limit here,
198
+ # note that permitting large numbers of watches may result in performance
199
+ # degradation and out-of-memory errors. The required memory per watcher is
200
+ # platform-dependent and defined as INOTIFY_WATCH_COST in fs/notify:
201
+ # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/notify/inotify/inotify_user.c
202
+ #
203
+ # The default in this file is 10 million watchers per user.
204
+ - name : " USER_WATCHES_MAX"
205
+ value : " 10485760"
189
206
command :
190
207
- sysctl
191
208
- -w
192
- - fs.inotify.max_user_watches=16384
209
+ - fs.inotify.max_user_watches=$(USER_WATCHES_MAX)
193
210
resources :
194
211
requests :
195
212
cpu : 10m
@@ -269,5 +286,7 @@ program sets the `fs.inotify.max_user_watches` setting.
269
286
a blog post describing a user's preferred settings, including file
270
287
exclusions
271
288
272
- If none of these steps resolve the issue, please
273
- [ contact us] ( https://coder.com/contact ) for further support.
289
+ If none of these steps resolve the issue, please [ contact us] for further
290
+ support.
291
+
292
+ [ contact us ] : https://coder.com/contact
0 commit comments