I'm not closing the file on purpose to try and simulate an error condition. My main question is why would it work differently from mod_perl 1.0 to 2.0?
Thanks, Justin -----Original Message----- From: Foo JH [mailto:[EMAIL PROTECTED] Sent: Sunday, May 20, 2007 7:15 PM To: Justin Luster Cc: modperl@perl.apache.org Subject: Re: File Handle Issues in Mod_Perl 2.0 Could be some internal optimsation issue. But I'd say that your best bet is to really close the file after you're done with it, and not let it hang around. This so especially when you are expecting multiple threads/ processes accessing the same file. Justin Luster wrote: > > Hi, > > A while back I posted an issue that I was having with mod_perl 2.0 > regarding file handles. Today I found an interesting clue to the problem. > > In my test script below I'm opening the same file twice in a row on > purpose without closing it. I'm trying to replicate a possible error > condition where the file might not be closed properly. When I run this > script on Apache 1.3 outside of Mod_Perl it works fine. When I run > this script on Apache 1.3 with Mod_Perl 1.0 it works fine. When I run > this script under Apache 2.0 Mod_Perl 2.0 it breaks (I'm on Red Hat > Linux). Basically on the 2^nd open the file offset does not start at > the beginning of the file as it does in my other tests. Further more > it is not consistent but starts doing the Mod_Perl weirdness of > sometimes working and sometimes not. > > The code that is breaking has been working for years but has started > to show errors when run under Mod_Perl 2.0 Apache 2.0. > > Does anyone know what might have changed in Mod_Perl 2.0 to have > caused this problem? > > Thanks for your help, > > Justin > > Here is my test script: > > my $strCGIPath = ""; > > if ((exists($ENV{'SCRIPT_FILENAME'}) || (defined > ($ENV{'SCRIPT_FILENAME'})))) > > { > > #Get absolute path to cgi-bin > > $strCGIPath = $ENV{'SCRIPT_FILENAME'}; > > } > > $strCGIPath =~ s/\/test.pl//; > > my $strFileName = $strCGIPath . "/" . "test.txt"; > > open (QUESTIONFILE,'<' . $strFileName) or print "Cant find file"; > > binmode QUESTIONFILE; > > #Get first line > > $_ = <QUESTIONFILE>; > > open (QUESTIONFILE,'<' . $strFileName) or print "Cant find file"; > > binmode QUESTIONFILE; > > seek QUESTIONFILE, 0, 0; > > #Get first line > > $_ = <QUESTIONFILE>; > > print $_; >