in reply to Re: File locking, lock files, and how it all sucks
in thread File locking, lock files, and how it all sucks
Unfortunately, this system has to run "everywhere" on stock Perl and stock modules. No RDMS for us. :( :( :(
There's no code in the system that would timeout - it's a straight open, flock, write, unflock, close, everywhere. If flocking is working as it should, the script SHOULD be waiting at the flock step until the other exclusives have released and it can get an exclusive.
What APPEARS to be happening is TWO instances of the script open the file at the same time, but one gets the exclusive lock first. It will do its thing, then release the lock. The second script will then write out ITS data to the start of the file (and/or is resetting the filehandle to the start - I'm not sure if the file cursor is based on what the O/S reports or where that particular script reports), and release its lock.
In other words, the flocking isn't doing the job well enough. I need to block before I even open the file.
Thank you for your continued thoughts. It's VERY appreciated!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: File locking, lock files, and how it all sucks
by dga (Hermit) on Aug 22, 2001 at 01:02 UTC |