Xxaxx has asked for the wisdom of the Perl Monks concerning the following question:
In case you haven't already guessed I've run into the "it waits indefinitely until the lock is granted" (Perl 5.6.0 Documentation) problem.
Fumbling around with this has raised several questions.
1) Under what condition does the sleep then try lock again mechanism so popular in file locking subroutines make any sense -- if it waits forever to lock the file maybe once is enough?
2) Is there a way to make an attempt to lock a file that will time out or give up after a certain amount of time?
3) In testing to find out what was happening I've created several dozen flocking-lost scripts that seem to just hang around forever. What is there to do about this?
It's easy enough to telnet into the server and kill the pid for each (abandoned? zombie? runaway?) script. I suppose if I knew the proper terminalogy for these I could better find where this is talked about.
I suppose if I solve the problem of indefinite wait for flock the runaway scripts problem will go away. However, I'd still be interested in links to a proper discussion of that issue.
I fully expect these subjects have been well-discussed else where. But in reading the various threads I'm not seeing any discussion of what to do to prevent the script just hanging around forever.
Thanks in advance.
Claude Needham
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: flock -- and indefinite wait
by Xxaxx (Monk) on Jul 23, 2003 at 07:50 UTC | |
by perlplexer (Hermit) on Jul 23, 2003 at 14:55 UTC | |
|
Re: flock -- and indefinite wait
by Mr_Person (Hermit) on Jul 23, 2003 at 19:02 UTC |