perl corrupting my open files - mkfifo?

J

Jeremy Slade

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
 
J

Jeremy Slade

Abigail said:
Jeremy Slade ([email protected]) wrote on MMMMCLXXXVI September
MCMXCIII in <URL:$$ 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
 
M

Martien Verbruggen

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
 
B

Brian McCauley

Jeremy said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top