Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: Notesfiles $Revision: 1.7.0.10 $; site convexs Path: utzoo!watmath!clyde!cbosgd!ihnp4!inuxc!pur-ee!uiucdcs!convex!convexs!hosking From: hosking@convexs.UUCP Newsgroups: net.bugs.4bsd Subject: Re: lprm hangs printer Message-ID: <33500007@convexs> Date: Mon, 31-Mar-86 09:05:00 EST Article-I.D.: convexs.33500007 Posted: Mon Mar 31 09:05:00 1986 Date-Received: Wed, 2-Apr-86 03:27:51 EST References: <256@entropy.UUCP> Lines: 48 Nf-ID: #R:entropy.UUCP:256:convexs:33500007:000:1405 Nf-From: convexs.UUCP!hosking Mar 31 08:05:00 1986 > /* Written 4:40 pm Mar 24, 1986 by ables@milano.UUCP in net.bugs.4bsd */ > The REAL fix, is to /usr/src/usr.lib/lpr/rmjob.c as follows: > 92c92 > < if (assasinated && !startdaemon(host)) > --- > > if (assasinated && !startdaemon(printer)) > > /* End of text from convexs:net.bugs.4bsd */ One of the people here added an additional fix to this code. There are apparently races possible between starting/killing daemons. Our version of rmjob.c looks like this: /* * Restart the printer daemon if it was killed * but first wait until the daemon is really dead */ if (assasinated) { /* added by ACS, 11/12/85 fixes lprm bug */ int lfd; /* lock file descriptor */ lfd = open(LO, O_WRONLY|O_CREAT, 0644); if (lfd < 0) { printf("cannot create %s", LO); exit(1); } /* when lock succeeds it's ok to restart the daemon */ if (flock(lfd, LOCK_EX) < 0) { printf("rmjob: cannot lock %s", LO); exit(1); } (void)close(lfd); /* implicit unlock */ } if (assasinated && !startdaemon(printer)) fatal("cannot restart printer daemon\n"); exit(0); } I've never really looked at the problem in any detail, but since this change went in, I don't recall ever seeing daemons lost due to lprm... and it happened quite a bit before the change went in. Doug Hosking Convex Computer Corp. Richardson, TX {allegra, ihnp4, uiucdcs}!convex!hosking