
	24) UUXQT Dies Mysteriously

From: tekcrd!teklabs!ucbcad!ucbvax:decvax!cca!ima!johnl
Date: Wed Oct 27 15:20:07 1982
Subject: Re: uuxqt dieing
Newsgroups: net.unix-wizards

The problem mentioned (that uuxqt will run about 10 jobs and then just
riffle through the spool directory) is well known.  One of the files that
gets opened doesn't get closed.  Match up the fopen() and fclose() calls
in the main program and it's easy to find.

Incidentally, uuxqt does an amazing amount of useless extra file opening
and closing.  Might be a good thing for somebody to clean up if they're
feeling bored.

John Levine, IECC, PO Box 349, Cambridge MA 02238; (617) 491-5450
decvax!cca!ima!johnl, harpo!esquire!ima!johnl, ucbvax!cbosgd!ima!johnl,
yale-co!jrl (all uucp), Levine@YALE (Arpa).



From: teklabs!ucbvax!mhtsa!alice!npoiv!harpo!duke!mcnc!idis!pitt!hoffman
Date: Thu Oct 28 14:48:33 1982
Subject: Re: uuxqt dieing
Newsgroups: net.unix-wizards

I had exactly the same problem with our 11/45 running vanilla V7 uucp.
It seems that the uuxqt.c author left out an fclose()!
Files keep getting opened without being closed and you run out of
file descriptors (which for most systems is 20)!  After much tracing,
I found where the missing fclose() should go.  A program segment
of uuxqt.c follows:

	.
	.
	.
		}
	rmfiles:
		xfp = fopen(xfile, "r");
		ASSERT(xfp != NULL, "CAN'T OPEN %s", xfile);
		while (fgets(buf, BUFSIZ, xfp) != NULL) {
			if (buf[0] != X_RQDFILE)
				continue;
			sscanf(&buf[1], "%s", file);
			unlink(file);
		}
		fclose(xfp);	/* Added forgotten fclose() */
		unlink(xfile);
	}
	.
	.
	.

Uuxqt now merrily processes the hundreds of news articles we receive
in a day.

Bob Hoffman, U. of Pittsburgh Computer Science
...mcnc!idis!pitt!hoffman



From: teklabs!harpo!floyd!cmcl2!philabs!sdcsvax!sdchema!jmcg
Date: Wed Oct 27 15:27:40 1982
Subject: bugfix for uuxqt dieing
Newsgroups: net.bugs.uucp

I investigated the problem of uuxqt quitting before it had processed
all of the queued files a couple of weeks ago.  It turns out that there
is an fopen unmatched by an fclose, so you run out of open file
descriptors.  This problem exists in the several different versions of
uuxqt I have been able to look at.

We experienced this problem in a more severe fashion because the same
type of error had been made in one of the local modifications to uuxqt--
the list of allowed commands was pulled out and put into a file.

In uuxqt.c, find the label `rmfiles':, and insert an `flcose(xfp)' before
the call to `unlink(xfile)':

------------------------------------------------------------------------
	rmfiles:
		xfp = fopen(xfile, "r");
		ASSERT(xfp != NULL, "CAN'T OPEN %s", xfile);
		while (fgets(buf, BUFSIZ, xfp) != NULL) {
			if (buf[0] != X_RQDFILE)
				continue;
			sscanf(&buf[1], "%s", file);
			unlink(file);
		}
>>>>>		fclose( xfp);
		unlink(xfile);
------------------------------------------------------------------------

	Jim McGinness UCSD Chemistry	(714)452-4016	sdcsvax!jmcg


From: tekmdp!teklabs!ucbcad!ARPAVAX:CSVAX:decvax!ittvax!tpdcvax!bobvan
Date: Fri Jun 11 18:28:55 1982
Subject: Bug in uuxqt.c
Newsgroups: net.bugs.uucp

Recently, I've noticed X.files lying around /usr/spool/uucp with no
daemon running to execute them.  A quick check of LOGFILE showed that a
given invocation of uuxqt never executed more than 16 X.files.  I've
traced the bug to a missing call to fclose() in uuxqt.c.  A maximum of
20 open files less 3 for stdin, stdout, stderr, and one to read the
spool directory leaves 16.

We've only been running uucp for about a month, and I find it to believe
that no one else noticed this bug.  Is there a collected log of uucp
bugs hidden on some system somewhere?

We are running 4.1bsd.  Diff -c follows:

	*** uuxqt.c	Fri Jun 11 16:06:45 1982
	--- uuxqt.orig.c	Fri May  7 10:59:42 1982
	***************
	*** 202,208
				sscanf(&buf[1], "%s", file);
				unlink(file);
			}
	- 		fclose(xfp);
			unlink(xfile);
		}
	  

	--- 202,207 -----
				sscanf(&buf[1], "%s", file);
				unlink(file);
			}
			unlink(xfile);
		}

Bob Van Valzah
(...!decvax!ittvax!tpdcvax!bobvan)


From: teklabs!decvax!harpo!ihps3!ixn5c!inuxc!pur-ee!ecn-pa:ecn-pb:rick
Date: Wed Oct 27 16:46:01 1982
Subject: Re: uuxqt dieing
Newsgroups: net.unix-wizards

I believe your problem is an old one with uucp. I think it is not
closing a file descriptor after it is done with it, so uuxqt
dies when it runs out of file descriptors.

Look at your source for uuxqt. At the end of the main program
(about line 230), it should look something like this:

	rmfiles:
		xfp = fopen(xfile, "r");
		ASSERT(xfp != NULL, "CAN'T OPEN %s", xfile);
		while (fgets(buf, BUFSIZ, xfp) != NULL) {
			if (buf[0] != X_RQDFILE)
				continue;
			sscanf(&buf[1], "%s", file);
			unlink(file);
		}
#ifdef	PURDUE_EE
		/* fix the hanging open fd! (dpk.bmd70@BRL 10-26-81) --aef */
		fclose(xfp);
#endif
		unlink(xfile);
	}

	if (stcico)
		xuucico("");
	cleanup(0);
}

If you dont have the fclose(xfp) line, thats your culprit.

Rick Adams

