[CLUE-Tech] Re: [CO-SAGE] Re: [lug] how to handle open files - upload server

Alek O. Komarnitsky (N-CSC) alek at ast.lmco.com
Tue Jan 13 13:54:04 MST 2004


> From co-sage-admin at fpcc.net Tue Jan 13 12:23 MST 2004
> From: rm at fabula.de
> 
>  An exclusive lock is almost a working solution -- iff all programs
>  involved honor it ...
> 
>  A _big_ caveat: all these techniques use non-atomic operations and
>  hence are vulnerable to race conditions (well, i'm not shure about
>  exclusive locking allone, i'd have to look it up).


I'm fairly certain that exclusive locking is "atomic" ... somewhat
defeats the purpose otherwise. And yes, to echo Ralf's comments,
you better make sure that EVERY application is using locking;
the analogy from the Perl cookbook is a stoplight - only works
if everyone stops when the light is red ... and this might be
kinda hard if it is coming in via FTP.

Note that file locking over NFS is problematic, but I don't
think you were doing that here.

BTW, be careful about using the old "touch a file, and if it exists,
then assume things are locked" ... since that is NOT an atomic
operation - I previousely mentioned my Xmas/2003 stats and I wrote
the code such that I tried the "touchfile" approach first and then
did file locking - I was curious to see if/when it would fail ... 
and it did 9 times - more info and code fragment halfway down here:
   http://www.komar.org/xmas/2003/stats/slashdot_effect.html

alek



More information about the clue-tech mailing list