Created
May 16, 2016 22:13
-
-
Save ffrank/855656e349501f9b3ac9780f6b88892a to your computer and use it in GitHub Desktop.
Inotify watch starvation and recovery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
graph: mygraph | |
comment: hello world example | |
resources: | |
file: | |
- name: dir1 | |
path: "/tmp/removeme/" | |
state: exists | |
- name: dir2 | |
path: "/tmp/removeme2/" | |
state: exists | |
edges: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create a tree with almost 8192 subdirectories | |
for i in `seq 1 8073` ; do HEX=`printf %04x $i` ; BASE=${HEX%??} ; mkdir -p /tmp/removeme/$BASE/$^CX ; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# however, removing each created subdirectory prior to making the next one will not deplete inotify watches | |
for i in `seq 1 10` ; do mkdir /tmp/removeme2/sub$i ; rmdir /tmp/removeme2/sub$i ; sleep .5 ; done | |
# alternatively, mgmt can take care of the removal itself (see following graph) | |
# then the loop from the previous example works as well and mgmt does not crash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
graph: mygraph | |
comment: hello world example | |
resources: | |
file: | |
- name: dir1 | |
path: "/tmp/removeme/" | |
state: exists | |
- name: dir2 | |
path: "/tmp/removeme2/" | |
state: exists | |
force: true | |
edges: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create some directories in /tmp/removeme2 | |
for i in `seq 1 10` ; do mkdir /tmp/removeme2/sub$i ; sleep .5 ; done | |
# this kills mgmt like this: | |
# 00:12:11 file.go:143: File[dir2]: Watching: /tmp/removeme2 | |
# 00:12:11 file.go:297: File[dir2]: adding /tmp/removeme2 to watch | |
# 00:12:11 file.go:297: File[dir2]: adding /tmp/removeme2/sub1 to watch | |
# 00:12:11 file.go:297: File[dir2]: adding /tmp/removeme2/sub2 to watch | |
# 00:12:11 file.go:297: File[dir2]: adding /tmp/removeme2/sub3 to watch | |
# 00:12:11 file.go:297: File[dir2]: adding /tmp/removeme2/sub4 to watch | |
# 00:12:11 file.go:154: File[dir2]: watcher.Add(/tmp/removeme2): Error: no space left on device | |
# 00:12:11 file.go:161: File[dir2]: Out of inotify watches! | |
# 00:12:11 file.go:162: no space left on device |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment