[ic] Runtime error: Could not lock file: Interrupted system call

Randy Moore interchange-users@icdevgroup.org
Mon Mar 31 16:19:01 2003


At 02:35 PM 3/31/2003 -0500, you wrote:
> > >Try down upgrade from perl 5.8 to 5.61. Its perl's problem
>on
> > >solaris.
> > >
> > >
> > Or try the patch I placed about two weeks ago to this list.
>It is not a
> > solaris problem, it is
> > a general incompatibility between perl 5.8.0 and interchange.
> >
> > Frederic
>
>Oh.. which patch? mind posting it again? I can't seem to find
>the 2003 mailling lists archive.

Hi,

Here is a variation on Frederic's patch that I made based on some comments 
about this problem in the interchange-core list.  It puts a limit on the 
number of flock attempts to prevent an infinite loop.

--- Util.orig.pm        2003-03-17 16:23:06.000000000 -0500
+++ Util.pm     2003-03-17 16:33:33.000000000 -0500
@@ -1413,7 +1413,12 @@
      my $flag = $excl ? $flock_LOCK_EX : $flock_LOCK_SH;

      if ($wait) {
-        flock($fh, $flag) or die "Could not lock file: $!\n";
+       my $failedcount = 0;
+       while(!flock($fh, $flag) && $failedcount < 30) {
+               $failedcount++;
+               sleep 1;
+       }
+       die "Could not lock file after 30 tries: $!\n" if ($failedcount == 30);
          return 1;
      }
      else {

I've been using this version for a couple of weeks on our development 
server and have yet to see it actually hit 30 failures.

Thanks much to Frederic for his investigate and initial patch.


Randy Moore
Axion Information Technologies, Inc.

email     ramoore@axion-it.net
phone   301-408-1200
fax        301-445-3947