Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!ucsd!ucbvax!TRANSARC.COM!Craig_Everhart From: Craig_Everhart@TRANSARC.COM Newsgroups: comp.mail.sendmail Subject: Re: too many open files Message-ID: <8bMxQHf0BwwOFbwZ9g@transarc.com> Date: 10 Dec 90 18:42:27 GMT References: <15632@cs.utexas.edu> Sender: daemon@ucbvax.BERKELEY.EDU Lines: 49 About four months ago, I was distributing a sendmail patch that helped eliminate duplicate messages that would occur when sendmail restarted its work on a given df*/qf* pair before it had finished the previous run (e.g. after a crash). The patch caused sendmail to rewrite the qf* file after each successful delivery. Now, this patch worked fine in 5.61-based sendmails. But in at least 5.64 and beyond, the interface to one of the routines that the patch used (queueup) changed, so that it opens a new file on each call and leaves it open, and the unmodified patch can fail because it didn't know to close any files. If you think that this is the root of your problems, I'll track down the fix to the patched version, which a friend of mine has been running in his configuration with no problems. Hm: it wasn't hard to find. Here's the change, if this was your problem. Down in sendall() in deliver.c, the guts of the checkpoint algorithm is an iterated call to queueup() that looks something like: { int estat; if (DoingMore) queueup(e, TRUE, FALSE, TRUE); DoingMore = FALSE; estat = deliver(e, q); /* Queueup if any delivered */ if (estat == EX_OK) DoingMore = TRUE; } I believe that the thing to do is this: { int estat; FILE *newfile; if (DoingMore) { newfile = queueup(e, TRUE, FALSE, TRUE); if (newfile) { (void) fclose(lockfp); lockfp = newfile; } } DoingMore = FALSE; estat = deliver(e, q); /* Queueup if any delivered */ if (estat == EX_OK) DoingMore = TRUE; } This will call queueup() again, but will correctly close the pointer to the old qf file that it just deleted (replacing it with the newly-written tf file). Good luck. Craig