recently i noticed, that the flask in debug doesn't reload in debug
mode with very simple test project (really "hello world").
After i dig more into it, i noticed that he default max number of
inotify watches was excess, as the flask installs 14772 watches (the
default max is 8192, i raised it to see exact result).
The flask process inotify inodes (in my case):
ll /proc/22770/fd/ | grep inotify
lr-x------ 1 slavko slavko 64 aug 12 13:07 10 -> anon_inode:inotify
lr-x------ 1 slavko slavko 64 aug 12 13:07 5 -> anon_inode:inotify
lr-x------ 1 slavko slavko 64 aug 12 13:07 6 -> anon_inode:inotify
lr-x------ 1 slavko slavko 64 aug 12 13:07 7 -> anon_inode:inotify
lr-x------ 1 slavko slavko 64 aug 12 13:07 8 -> anon_inode:inotify
lr-x------ 1 slavko slavko 64 aug 12 13:07 9 -> anon_inode:inotify
The fd 5 -- 10 (slightly more than real, as the file header is counted
too):
LANG=C wc -l /proc/22770/fdinfo/{5..10}
92 /proc/22770/fdinfo/5
4 /proc/22770/fdinfo/6
14682 /proc/22770/fdinfo/7
4 /proc/22770/fdinfo/8
5 /proc/22770/fdinfo/9
3 /proc/22770/fdinfo/10
14790 total
As you can see, the fd 7 contains most of watches, by checking by the
inode number in fdinfo/7, all inodes are unique. I tried only some of
them as i am not aware of better way than use find, but most of them
seems to point to files/directories under
/usr/lib/python3/dist-packages/ (some reports duplicity, as they are on
different FS):
awk '/ino:/{print $3}' /proc/22770/fdinfo/7 | sed 's/^ino://' \
| while read hnum; do echo $((16#$hnum)); done \
| while read dnum; do \
echo $dnum:; echo -n " * "; \
find / -inum $dnum 2>/dev/null; done
6167661:
* /usr/lib/python3/dist-packages/httpbin/templates/images
6167655:
* /usr/lib/python3/dist-packages/httpbin/templates
6029766:
* /usr/lib/python3/dist-packages/httpbin/__pycache__
1446824:
* /var/cache/lxc/debian/rootfs-testing-amd64/var/lib/dpkg/info/libtasn1-6:amd64.symbols
/usr/lib/python3/dist-packages/nacl/bindings
1446799:
* /var/cache/lxc/debian/rootfs-testing-amd64/dev/tty
/usr/lib/python3/dist-packages/nacl/pwhash
5386798:
* /usr/lib/python3/dist-packages/Cryptodome/Util/__pycache__
5386777:
* /usr/lib/python3/dist-packages/Cryptodome/Random/__pycache__
5386771:
* /usr/lib/python3/dist-packages/Cryptodome/Math/__pycache__
5386774:
* /usr/lib/python3/dist-packages/Cryptodome/PublicKey/__pycache__
5386765:
* /usr/lib/python3/dist-packages/Cryptodome/Hash/__pycache__
5386797:
* /usr/lib/python3/dist-packages/Cryptodome/Signature/__pycache__
5386794:
* /usr/lib/python3/dist-packages/Cryptodome/SelfTest/Util/__pycache__
5386791:
* /usr/lib/python3/dist-packages/Cryptodome/SelfTest/Random/__pycache__
5386787:
* /usr/lib/python3/dist-packages/Cryptodome/SelfTest/Math/__pycache__
5386619:
* /usr/lib/python3/dist-packages/Cryptodome/SelfTest/PublicKey/test_vectors/RSA
5386542:
* ^C
This make flask development with default settings unusable and
there must be something wrong with installing watches. I do not use
flask dev often, thus i am not sure from when it happens.
I am not sure, if with this status the flask have to go into stable,
while this must no affect running it in "normal" (nondev) mode.
regards