Subject: Re: Tracking down hang ftps

From: "Karl O. Pinc" <[email-masked]>
Date: Fri, 17 Jan 1997 16:42:47 -0600

>Hello
>
>I would like to have feedback on this.
>
>1-
>
> acl_join(), acl_remove(), acl_countusers() have this same lock
>scheme:
>
>pseudo-code:
>
>   while(get_a_lock) {
>      ..
>     /* sleep 'til you get the lock */
>     sleep(1);
>   }
>
>This is a bummer especially on my busiest ftp servers.
>I was unable to track down why exactly the processes go on
>a limb like this(lots of idea 'though).
>
>And of course syslog gets filled with the usual:
>"sleeping: fcntl lock of pid file failed:"
>
>For the lack of better idea I'm proposing this:
>
>pseudo-code:
>
>  while(get_a_lock || n == MAX_LOCK_WAIT) {
>    n = 0;
>    if (n == MAX_LOCK_WAIT)
>      do_logout() /* or just exit() */
>   ...
>   sleep(1);
>   n++
> }

I like:

if (get_a_lock) {
  log("sleeping on lock");
  timeout=MAX_LOCK_WAIT;
  if (sleep_on_lock(timeout) == TIMED_OUT) {
     log("timed out waiting for lock");
     exit(1);
  }
  log("successfully got lock");
}

Karl

May the Legos (TM) always be swept from your path in the night.