New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No support inotify_add_watch() in docker overlayfs storage backend #11705
Comments
IIRC, overlayfs does not fully support inotify ( so tail / inotifywatch may not work ) |
Hi,I found history discussion here: It seems that --disable-inotify is a good solution and merits being made into a feature. So i exec:
it works. |
http://whichstoragedrivershouldiuse.github.io/ Easy, the one without inotify support :( |
for testing, you could try: https://launchpadlibrarian.net/149319334/overlayfs_inotify.patch |
Ran into this problem today with docker 1.8.2 using overlay-fs. Testcase:
Correct output should be: Setting up watches. For some reason, IN_ATTRIB is still raised so my temporary workaround is to react to that signal instead for now. |
Another example where it works when the storage driver is #include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <stdio.h>
#include <assert.h>
#include <sys/inotify.h>
#include <sys/syscall.h>
struct InotifyEvent {
int wd;
uint32_t mask;
uint32_t cookie;
uint32_t len;
char name __flexarr;
};
int main() {
int fd;
int inotifyFd;
int watchDescriptor;
char file[] = "/tmp/inotify_test.XXXXXX";
struct InotifyEvent* event;
printf("Inotify on a File.\n");
// Create a file
fd = mkstemp(file);
assert(fd > -1);
inotifyFd = inotify_init();
assert(inotifyFd > -1);
// add watch on the file for modify and delete
watchDescriptor = inotify_add_watch(inotifyFd,
file,
IN_MODIFY |
IN_DELETE_SELF);
assert(watchDescriptor > -1);
// modify file;
write(fd, "test", sizeof("test"));
fflush(NULL);
// check modify
event = reinterpret_cast<InotifyEvent*>(malloc(sizeof(*event)));
assert(read(inotifyFd, event, sizeof(InotifyEvent)) > 0);
assert(watchDescriptor == event->wd);
assert(IN_MODIFY == event->mask);
// check delete
assert(0 == remove(file));
assert(0 == close(fd));
assert(read(inotifyFd, event, sizeof(InotifyEvent)) > 0);
assert(watchDescriptor == event->wd);
assert(IN_DELETE_SELF == event->mask);
free(event);
} In |
This test uses inotify which doesn't work well with docker overlayfs. More information about this can be found in: moby/moby#11705 Testcase: > # Example: loops monitoring events forever. > import pyinotify > > # Instanciate a new WatchManager (will be used to store watches). > wm = pyinotify.WatchManager() > # Associate this WatchManager with a Notifier (will be used to report > # and process events). > notifier = pyinotify.Notifier(wm) > # Add a new watch on /tmp/foo for ganeti's MODIFY and IGNORED events. > wm.add_watch('/tmp/foo', pyinotify.IN_MODIFY | pyinotify.IN_IGNORED) > # Loop forever and handle events. > notifier.loop()
This test uses inotify which doesn't work well with docker overlayfs. More information about this can be found in: moby/moby#11705 Testcase: > # Example: loops monitoring events forever. > import pyinotify > > # Instanciate a new WatchManager (will be used to store watches). > wm = pyinotify.WatchManager() > # Associate this WatchManager with a Notifier (will be used to report > # and process events). > notifier = pyinotify.Notifier(wm) > # Add a new watch on /tmp/foo for ganeti's MODIFY and IGNORED events. > wm.add_watch('/tmp/foo', pyinotify.IN_MODIFY | pyinotify.IN_IGNORED) > # Loop forever and handle events. > notifier.loop()
This test uses inotify which doesn't work well with docker overlayfs. More information about this can be found in: moby/moby#11705 Testcase: > # Example: loops monitoring events forever. > import pyinotify > > # Instanciate a new WatchManager (will be used to store watches). > wm = pyinotify.WatchManager() > # Associate this WatchManager with a Notifier (will be used to report > # and process events). > notifier = pyinotify.Notifier(wm) > # Add a new watch on /tmp/foo for ganeti's MODIFY and IGNORED events. > wm.add_watch('/tmp/foo', pyinotify.IN_MODIFY | pyinotify.IN_IGNORED) > # Loop forever and handle events. > notifier.loop()
This test uses inotify which doesn't work well with docker overlayfs. More information about this can be found in: moby/moby#11705 Testcase: > # Example: loops monitoring events forever. > import pyinotify > > # Instanciate a new WatchManager (will be used to store watches). > wm = pyinotify.WatchManager() > # Associate this WatchManager with a Notifier (will be used to report > # and process events). > notifier = pyinotify.Notifier(wm) > # Add a new watch on /tmp/foo for ganeti's MODIFY and IGNORED events. > wm.add_watch('/tmp/foo', pyinotify.IN_MODIFY | pyinotify.IN_IGNORED) > # Loop forever and handle events. > notifier.loop()
This is an old issue. I will close it as stale. |
Hi, I try to start a container which use overlayfs.
when i exec:
it'll block after show serveral headlines.
i exec:
it shows:
then block
i exec:
show:
but i has sustained flushing text to xx.log
so why doesn't overlayfs support inotify_add_watch()?
sysinfo:
Linux 3b6656e0c11c 3.19.0-9-generic #9-Ubuntu SMP Wed Mar 11 17:50:03 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Docker version 1.5.0-dev, build a78ce5c
The text was updated successfully, but these errors were encountered: