Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

RE: RE: RE: RE: RE: RE: Flock Subroutine

by tilly (Archbishop)
on Aug 08, 2000 at 18:17 UTC ( #26786=note: print w/replies, xml ) Need Help??


in reply to RE: RE: RE: RE: RE: Flock Subroutine
in thread Flock Subroutine

Many experienced programmers do not understand races either. For instance every select() loop has a race condition - between you being notified and you trying to respond, the data may have gone. Early versions of Apache suffered from this problem, one request could tie up several children.

A related bug warning. The examples in the documentation and in the Perl Cookbook of using flock with DB_File are not safe. It was discovered last fall that the first page of the database is read before you have a chance of locking the dbm, and in some cases BerkeleyDB will close and reopen the file behind your back.

  • Comment on RE: RE: RE: RE: RE: RE: Flock Subroutine

Replies are listed 'Best First'.
RE: RE: RE: RE: RE: RE: RE: Flock Subroutine
by KM (Priest) on Aug 08, 2000 at 18:22 UTC
    This is why good ole whiteboards and a bunch of cow orkers are helpful. Knowing flow, seeing possible conditions, and knowing tidbits about software. Of course, using a semaphore file should solve these issues, since you take the actual locking piece away from the wanted data set. For example, if you lock a semaphore before opening the DBM, the DBM can close and reopen all it wants, since the semaphore is the lock.

    Cheers,
    KM

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2021-12-01 06:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?