perl corrupting my open files - mkfifo?

Discussion in 'Perl Misc' started by Jeremy Slade, Feb 15, 2005.

  1. Jeremy Slade

    Jeremy Slade Guest

    I'm running perl 5.6.1 on linux i686 kernel 2.6.8

    I had a very strange experience this morning that is rather alarming to
    me. I was running a perl script that has been running many hundreds of
    times before... I had executed it with the incorrect options, so I hit
    Ctrl-C to kill it.

    Somehow the result of this is that every file to which I had an open
    handle became a unix FIFO on disk -- as though the file was removed,
    then mkfifo was run in it's place. e.g. it look like this afterwards:

    % ls -lF foo
    prw-rw-r-- 1 jgs jgs 0 Feb 15 10:39 foo|

    Some file were opened with IO::File->new(), some were opened via perl's
    'do' function -- and it least one case was a symlink on a path to an
    open file, but not the actual file itself.

    Can anyone please explain how this could happen? I check the perl 5.6.1
    source code for all occurrences of mkfifo or mknod, I don't see anything
    where it is used except in the xs interface stuff, nothing internal.
    This is not only baffling, but also alarming that this could happen.

    Thanks in advance,
    Jeremy
     
    Jeremy Slade, Feb 15, 2005
    #1
    1. Advertising

  2. Jeremy Slade

    Jeremy Slade Guest

    Abigail wrote:
    > Jeremy Slade () wrote on MMMMCLXXXVI September
    > MCMXCIII in <URL:news:cuthvt$vka$>:
    > $$ I'm running perl 5.6.1 on linux i686 kernel 2.6.8
    > $$
    > $$ I had a very strange experience this morning that is rather alarming to
    > $$ me. I was running a perl script that has been running many hundreds of
    > $$ times before... I had executed it with the incorrect options, so I hit
    > $$ Ctrl-C to kill it.
    > $$
    > $$ Somehow the result of this is that every file to which I had an open
    > $$ handle became a unix FIFO on disk -- as though the file was removed,
    > $$ then mkfifo was run in it's place. e.g. it look like this afterwards:
    > $$
    > $$ % ls -lF foo
    > $$ prw-rw-r-- 1 jgs jgs 0 Feb 15 10:39 foo|
    > $$
    > $$ Some file were opened with IO::File->new(), some were opened via perl's
    > $$ 'do' function -- and it least one case was a symlink on a path to an
    > $$ open file, but not the actual file itself.
    > $$
    > $$ Can anyone please explain how this could happen? I check the perl 5.6.1
    > $$ source code for all occurrences of mkfifo or mknod, I don't see anything
    > $$ where it is used except in the xs interface stuff, nothing internal.
    > $$ This is not only baffling, but also alarming that this could happen.
    >
    >
    > Can you repeat the procedure? Does it happen with 5.8.6 as well? If so,
    > can you post a small piece of code that shows this behaviour? If you
    > can't repeat it, how do you know this problem is due to a problem with Perl?


    That's the problem - I can't reproduce it, and can't explain it based on
    anything I'm doing are can find in the perl code. But it definitely
    happened as a result of running the perl script. So I'm looking for any
    possible explanation as to how something like this could happen.


    Thanks,
    Jeremy
     
    Jeremy Slade, Feb 15, 2005
    #2
    1. Advertising

  3. On Tue, 15 Feb 2005 12:19:24 -0700,
    Jeremy Slade <> wrote:
    > I'm running perl 5.6.1 on linux i686 kernel 2.6.8
    >
    > I had a very strange experience this morning that is rather alarming to
    > me. I was running a perl script that has been running many hundreds of
    > times before... I had executed it with the incorrect options, so I hit
    > Ctrl-C to kill it.
    >
    > Somehow the result of this is that every file to which I had an open
    > handle became a unix FIFO on disk -- as though the file was removed,
    > then mkfifo was run in it's place. e.g. it look like this afterwards:


    Have you ever heard of a "post hoc, ergo propter hoc" fallacy? Jst
    because you noticed this just after you interrupted a Perl program,
    doesn't mean that this was caused by you interrupting the Perl
    program.

    Martien
    --
    |
    Martien Verbruggen | There are only 10 types of people in the
    | world; those who understand binary and those
    | who don't.
     
    Martien Verbruggen, Feb 16, 2005
    #3
  4. Jeremy Slade wrote:

    > I'm running perl 5.6.1 on linux i686 kernel 2.6.8
    >
    > I had a very strange experience this morning that is rather alarming to
    > me. I was running a perl script that has been running many hundreds of
    > times before... I had executed it with the incorrect options, so I hit
    > Ctrl-C to kill it.
    >
    > Somehow the result of this is that every file to which I had an open
    > handle became a unix FIFO on disk -- as though the file was removed,
    > then mkfifo was run in it's place. e.g. it look like this afterwards:
    >
    > % ls -lF foo
    > prw-rw-r-- 1 jgs jgs 0 Feb 15 10:39 foo|


    I have seen similar corruption to files that had been recently open (not
    necessarily by Perl) on Linux ext2 filesystems that were not cleanly
    unmounted. Has there perhaps been a system crash, power outage or disk
    hardware falure?

    Anyhow this is more likely a Linux problem than a Perl one so I suggest
    you ask in a Linux newsgroup. Upgrading to a resilient FS seems to have
    stopped the problem.
     
    Brian McCauley, Feb 16, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gigs_

    os.mkfifo

    Gigs_, Jan 11, 2007, in forum: Python
    Replies:
    1
    Views:
    578
    Jerry Hill
    Jan 11, 2007
  2. TungstenCoil
    Replies:
    7
    Views:
    401
  3. Gary Wessle

    while getline corrupting the stream

    Gary Wessle, Mar 1, 2007, in forum: C++
    Replies:
    4
    Views:
    369
  4. Derrick

    http download corrupting zip file

    Derrick, Nov 11, 2004, in forum: ASP General
    Replies:
    3
    Views:
    220
    Derrick
    Nov 11, 2004
  5. michal

    corrupting global.asa

    michal, Apr 17, 2007, in forum: ASP General
    Replies:
    1
    Views:
    108
    Bob Barrows [MVP]
    Apr 17, 2007
Loading...

Share This Page