Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Re: Mysterious Disapperance of file contents

by aquarium (Curate)
on Aug 29, 2003 at 12:45 UTC ( #287633=note: print w/replies, xml ) Need Help??


in reply to Re: Mysterious Disapperance of file contents
in thread Mysterious Disapperance of file contents

Gorby is also chomping an array instead of just using a scalar all the way through. There's 3 opens and closes for the counterfile: first open in append, second open in RW, and third open in write. this spells disaster when not locking the lock/semaphore file properly using sysopen and flock. Therefore, when the server is busy, and the semaphore lock fails, the counter file is clobberred by another instance of the prog. It could have been written with just a single lock on the counter file itself: but locked properly (sysopen/flock) and openned and closed once, not 3 times.
  • Comment on Re: Re: Mysterious Disapperance of file contents

Replies are listed 'Best First'.
Re: Mysterious Disapperance of file contents
by Abigail-II (Bishop) on Aug 29, 2003 at 12:51 UTC
    Therefore, when the server is busy, and the semaphore lock fails, the counter file is clobberred by another instance of the prog.

    No. The code says:

    flock(SEM, LOCK_EX) || die "Lock failed: $!"

    If a lock fails, the program exits, so it can't clobber.

    Abigail

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://287633]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2020-06-06 20:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?



    Results (41 votes). Check out past polls.

    Notices?