XP is just a number | |
PerlMonks |
flock -- and indefinite waitby Xxaxx (Monk) |
on Jul 23, 2003 at 06:23 UTC ( [id://277049]=perlquestion: print w/replies, xml ) | Need Help?? |
Xxaxx has asked for the wisdom of the Perl Monks concerning the following question:
Don't know how I went so long without getting this right, be that as it may, I need to straighten my flock out. 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.
Back to
Seekers of Perl Wisdom
|
|