View previous topic :: View next topic |
Author |
Message |
timerison30 -
Joined: 03 Aug 2002 Posts: 1
|
Posted: Sat Aug 03, 2002 5:12 am Post subject: 200 Error and FLOCK |
|
|
I'm a little new to cgi/perl, but I was getting a 200 error and read everything I could about it (since I love this server prog so much) but couldn't find the problem. I found the problem at last, and thought I would share with whoever may need to know this in the future (would have saved me a few days). :?
Anyways, here it is:
When writing and reading to files with your script, if you try and use "flock", no matter how much output you have at the end of your .cgi or .pl, it will give you a 200 error message. :wink:
I.E.
flock(OUTF,2);
So delete it!
Hope this helps someone. :D |
|
Back to top |
|
|
rockslammer_ -
Joined: 19 Sep 2003 Posts: 6 Location: Michigan
|
Posted: Thu Dec 18, 2003 7:13 am Post subject: Fat32 and NT flock? |
|
|
Windows can not "lock" a file
UNIX can
flock is not compatable with Windows |
|
Back to top |
|
|
brokndodge -
Joined: 30 Nov 2003 Posts: 6
|
Posted: Thu Dec 18, 2003 5:25 pm Post subject: flock() on win32 |
|
|
i have a lil more info than that. but not much more... i had same prob on deff server i have switched to. by third party billing company was trying to use a unix script on my win32 machine. he found a short piece of code to replace the flock statement by doing a search on google for flock.
i tries same search and came up with nil but u can give it a shot if u want... i have the patched script on my server and it's werking great. i just don't know which piece of code he patched. |
|
Back to top |
|
|
Alaxandair -
Joined: 17 Apr 2003 Posts: 5
|
Posted: Fri Dec 19, 2003 12:05 am Post subject: |
|
|
Incorrect!
Flock is Implemented (compatable) with Windows NT, 2000 & XP.
It will not work on 9x or ME. |
|
Back to top |
|
|
rockslammer_ -
Joined: 19 Sep 2003 Posts: 6 Location: Michigan
|
Posted: Fri Dec 19, 2003 1:49 am Post subject: Yep |
|
|
I stand corrected I guess :?:
NTFS can lock
9x etc can't
Then again then a lot of programs out there
suggest that when run on Windows
change from =1 to =0 on certain locking
routines (old pre NT?).
I never had this problem with flock,
But then I never used Perl on Win9x only NTFS.
http://support.microsoft.com/default.aspx?scid=kb;en-us;823272&Product=win2000
"This problem may occur if the client program performs a
particular sequence of lock requests on the data file, and
as a result, the client program that is granted the lock never
receives the lock. This problem occurs because of a redirector
opportunistic locking issue. "
This is in reference to NFS not Perl per se,
but Windows has a lot of file issues.
So, file locking will work...
However, when trouble shooting
if it errors,
#comment it out,
see what happens,
Unfortunately, without a file lock the data can get corrupted.
Sometimes I'll open Abyss' log file to save it to
analog and run a report... Occasionally, I will get a number
of corrupted lines reported, this is not Perl flock per se,
File lock problem? Totaly unrelated, some process during
the time period of the log and unrelated causing it?
Anothers Windows "mystery".
This is interesting also-
Not what caused the original problem
http://aspn.activestate.com/ASPN/Mail/Message/1205718
flock will work fine as long as all programs accessing a locked file are
using flock(i.e. non-perl programs won't play nice). Also, don't bother
using any Win9x flavor if you expect flock to work.
happy coding :D |
|
Back to top |
|
|
rdemartini -
Joined: 29 Nov 2003 Posts: 2
|
Posted: Sat Dec 27, 2003 6:09 pm Post subject: |
|
|
This is a definite pisser, since most perl related programs that I want to run use flock. This took me a while to figure out to, but I read that you can use flock in XP?
I'll have to see if that is true. I wanted to avoid upgrading my server box (Win98) but I guess the necessary MS evil lives on.
-R |
|
Back to top |
|
|
|