concurrent write and read to the same file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



GlusterFS 3.1.0, distributed volumes, rdma transport, CentOS 5.4/5.5.

I was doing "tail -f" on a log file while the program generating it
was running and noticed some strange behavior.  I wasn't able to
reproduce exactly the same strange behavior, but here is some which
did reproduce for me reliably.  This is a small perl program producing
a bit of output every few seconds:
    $| = 1;
    for ($i=0; $i < 100; ++$i) {
        printf("This is line $i\n");
        sleep(3);
    }

If I run it with output sent to a gluster volume,
   perl foo.pl > bar
it works fine: "bar" has the right content after the script
terminates, or if I kill the script while it runs "bar" has a valid
partial output.

While the perl script is running, if I log into a different host which
can see that volume and do "tail -f bar" that also works fine: every
few seconds, the next line of output appears.

However, while the perl script is running if I do "tail -f bar" from
the same host as the script is running on, it will print me the
current end of the file but then it will hang without producing any
subsequent output.  This is true whether or not I have a tail running
on a different host concurrently.

The tail on the same host as the script will correctly notice that the
file was reset if I kill and restart the perl script while leaving the
tail running.  Then it prints the first line, but at that point it
hangs again.

Anyone else seeing this?  Any ideas what might be reasons why?

Thanks!


.. Lana (lana.deere at gmail.com)


[Index of Archives]     [Gluster Development]     [Linux Filesytems Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux