Checked to be sure I'm closing file handles, etc -> that's okay. But every time I run it, between 1 and 4 of the files are corrupt that are being written...not the same files every time, either.
Any ideas?
This is a snippet of the code that I'm using, the one that prints to the file:
[perl]
open(OUT, ">./out/$outfile")¦¦die "could not open $outfile\n $!";
print OUT @template;
close(OUT)¦¦die "could not close $outfile\n";
[/perl]
Strange thing is, it's not a buffer issue (far as I can tell) as when I flush it during the loop or the middle of the program, still happens the same way.
On top of that, it's random files that are corrupted on the ouput...never the same ones, on multiple runs of the script.
Anybody else got an idea?
And it's being run from a *nix server / with apache....do you think some kind of server hiccup / pause it causing the output error?
I can transfer the whole thing to another box...but that will take some time -> was hoping to fix the problem before trying to reinstall another place.
Symptoms: Files can be corrupted or deleted when a cgi process is run. Scripts that have been running fine for years with no problem suddenly go binary and fail. My host also found a self replicating file that eventually caused a space issue on the server.
I should note, I haven't had anymore of these problems (yet) after the host got involved which was several days ago.