[Boston.pm] Perl flock problem?

2012-04-06 Thread ja...@nova-sw.com
we're running a pre-forking server with a number of child processes which, among other things, archive incoming files to a common archive file. Contention for the tar file is handled by perl's flock: my $fh = IO::File-new( $archdir/$arch_filename) || die Can't open

Re: [Boston.pm] Perl flock problem?

2012-04-06 Thread Kenneth Graves
Is tar releasing the lock? You might try using flock on a separate lock file instead of locking the archive itself. --kag On Apr 6, 2012, at 5:56 AM, ja...@nova-sw.com wrote: we're running a pre-forking server with a number of child processes which, among other things, archive incoming files

Re: [Boston.pm] Perl flock problem?

2012-04-06 Thread ja...@nova-sw.com
Good point, could be. We'll try that. Thanks. - Original Message Follows - From: Kenneth Graves k...@citysource.com To: ja...@nova-sw.com Cc: Boston Perl Mongers boston...@pm.org Subject: Re: [Boston.pm] Perl flock problem? Date: Fri, 6 Apr 2012 12:47:56 -0500 Is tar releasing the

Re: [Boston.pm] Perl flock problem?

2012-04-06 Thread Duane Bronson
Possibly, you are locking AFTER the file is getting created, so it's possible two processes will create the file at about the same time (one will get unlinked from the filesystem), and then both file handles will obtain a different lock. The suggestion to lock a different file will have the

Re: [Boston.pm] Perl flock problem?

2012-04-06 Thread Wayne Tackabury
Hi Jim: And even if it is (releasing the lock, all orderly and everything), I'd generally never use anything but a zero-length shadow file for this kind of locking action, to elaborate on Kenneth's suggestion. If you're building up the archive, and if it's getting sizeable, it's possible that