libinotify-kqueue icon indicating copy to clipboard operation
libinotify-kqueue copied to clipboard

Lost deletion events

Open mechanicalapple opened this issue 10 years ago • 2 comments

I use the current version of code from in_isdir branch on FreeBSD 10.0-RELEASE #0 r260789 amd64 with simple demo software, described below. I found, that libinotify-kqueue works properly during some short time and fails to detect deletion events after that. Even after reboot. I'm not sure, but this problem may be related with pipe creation in watching directory. But this pipe was deleted before next booting. Source code of used tool is based on http://man7.org/tlpi/code/online/dist/inotify/demo_inotify.c.html

#include <sys/inotify.h>
#include <stdio.h>
#include <unistd.h>

#define BUF_LEN (1<<16)

int main(int argc, char *argv[])
{
        int fd, wd, numRead;
        char buf[BUF_LEN];

        fd = inotify_init();
        wd = inotify_add_watch(fd, argv[1], IN_ALL_EVENTS);

        for (;;)
        {
                numRead = read(fd, buf, BUF_LEN);
                if (numRead > 0)
                {
                        printf("Got something\n");
                }
        }

        return 0;
}

P.S. Sorry for my English

mechanicalapple avatar Sep 19 '14 14:09 mechanicalapple

Hi and thanks for report! I've already received an issue related to pipes in the watched directories, I will have a look on the problem tomorrow.

Do you watch any specific directory or can you provide a scenario of changes you do in the directory to reproduce the issue?

Thanks, Dmitry

dmatveev avatar Sep 19 '14 17:09 dmatveev

Hi. Sorry for waiting for answer. I had no PC at weekend. No, I watch ordinary directory with no specific features. It was created by mkdir -m 700 -p testdir/from I create files, symbolic links and named pipes with using touch, ln and mknod. Then, delete it with rm. There are nothing special, just test issue. Actually, it is a test for clsync utility, but i have same problems with my testing tool too. At first time, clsync fails with deleting of pipe. It is difficult to give you some specific scenario, because i can't fix it to test another time. But I already have a broken system, so, i can collect some info on it.

mechanicalapple avatar Sep 22 '14 07:09 mechanicalapple