R
Ryan Tate
I have a perl script that runs reports on a log file. It locks this
file with
(flock $fh, LOCK_EX|LOCK_NB) or die "Could not lock file: $!";
Several days ago I invoked the script via CGI. While my browser was
still receiving lines from the script, and before it had time to
finish its run, I hit "Stop" in my browser, presumably before the
filehandle could close and release the lock. Ever since, the script
cannot get a new lock on the file. I get the $! error "Resource
temporarily unavailable." When I remove the lock code from my script,
it works as it did before.
So I suspect I have a days-old zombie lock still tying up the file,
and I want to know how to get rid of it.
I have tried running the script with LOCK_UN in place of LOCK_EX, but
I don't think this is what I'm looking for. I have tried ps -u
myusername at the console and don't see any unusual
processes to kill.
I have no idea what the lock file name would be for my platform, SunOS
5.8, otherwise I would rm the file manually.
I have tried looking this up in:
*The Camel
*Usenet archive for c.l.p* and generally for unix, sunos and solaris
*FAQ for this group
*flock manpage for my system (which seems to describe a C api call,
not an actual utility)
*Unix System Administrator Handbook, 3rd ed, Nemeth, Snyder, Seebass &
Hein
Anyone have any suggestions?
Gratefully,
RT
file with
(flock $fh, LOCK_EX|LOCK_NB) or die "Could not lock file: $!";
Several days ago I invoked the script via CGI. While my browser was
still receiving lines from the script, and before it had time to
finish its run, I hit "Stop" in my browser, presumably before the
filehandle could close and release the lock. Ever since, the script
cannot get a new lock on the file. I get the $! error "Resource
temporarily unavailable." When I remove the lock code from my script,
it works as it did before.
So I suspect I have a days-old zombie lock still tying up the file,
and I want to know how to get rid of it.
I have tried running the script with LOCK_UN in place of LOCK_EX, but
I don't think this is what I'm looking for. I have tried ps -u
myusername at the console and don't see any unusual
processes to kill.
I have no idea what the lock file name would be for my platform, SunOS
5.8, otherwise I would rm the file manually.
I have tried looking this up in:
*The Camel
*Usenet archive for c.l.p* and generally for unix, sunos and solaris
*FAQ for this group
*flock manpage for my system (which seems to describe a C api call,
not an actual utility)
*Unix System Administrator Handbook, 3rd ed, Nemeth, Snyder, Seebass &
Hein
Anyone have any suggestions?
Gratefully,
RT