[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Zmailer Failure Running Large Listfiles

> Hello.
> I am running zmailer on an Intel 310/20 and have been running a lot
> of listfiles but have discovered that listfiles with over 125
> subscribers exceeds the virtual memory of the system and causes
> the entire system to totally crash.  After reviving it from the
> dead I must delete all mail from the router/queue/transport
> and start and stop the mailer several times before all is well.
> Anyone have any ideas, comments, recommendations etc.?  Thanks...

  So you too did discover that the way the present list expansion
  is written causes exponential memory consumption...

  I have a temporary kludge attached at the end of this letter.
  It should be used in a manner similar to the classical:

  ----- /etc/aliases -----
  listname: "|/path/to/listexpand owner@address /path/to/file/of/addresses"

  See the comments at the begin of the file.  It really expects things
  from the addresses, and if you have X.400 addresses with spaces in
  them, it will fail... (at that line)

  I am writing internal expander that doesn't bloat memory, but it is
  still in a bit poor shape -- causes crashes..   Until it works, 3.0
  is in the hold...  (2.98 comes before it, though..)

> --bob
> ***********************************************************************
> Robert (Bob) L. Stringfield      HQ USAREUR & 7A (ODCSPER)
> bstring@heidelberg-emh17.army.mil or bstring@odcsper.heidelberg-emh17.
> army.mil or root@heidelberg-emh17.army.mil

	/Matti Aarnio	<mea@utu.fi> <mea@nic.funet.fi>

 *  listexpand -- expand mailinglist from a file to have an envelope
 *		  containing all the addresses listed individually.
 *  listexpand owner@address /path/to/file/containing/addresses
 *  This EXPECTS things from the listfile:
 *	recipient@address <TAB> (other data in comments) <NEWLINE>

#include <stdio.h>
#include "sysexits.h"
#include "mail.h"

char *progname = "listexpand";

extern char *strchr();

void usage()
  fprintf(stderr,"%s:  owner@address /path/to/file/containing/addresses\n",

     int argc;
     char *argv[];
	FILE *mfp = NULL;
	FILE *addrfile;
	char *s;
	char buf[8192];

	if (argc != 3)
	if ((addrfile = fopen(argv[2],"r")) == NULL)

	while (!feof(addrfile) && !ferror(addrfile)) {

	  /* See if the file has some address in it! */
	  if (fgets(buf,sizeof(buf)-1,addrfile) == NULL) 

	  /* Chop them of first TAB, SPC, or NEWLINE */
	  s = strchr(buf,'\t');
	  if (!s) s = strchr(buf,' ');
	  if (!s) s = strchr(buf,'\n');
	  if (s) *s = 0;

	  /* Blank line -- or started with TAB or SPC.. */
	  if (buf[0] == 0) continue;

	  /* Open the spool file for the first recipient */
	  if (!mfp) {
	    mfp = mail_open(MSG_RFC822);
	    if (!mfp) exit(EX_CANTCREAT); /* ??? */
	    if (argv[1][0] == 0 || argv[1][0] == ' ')
	      fprintf(mfp,"channel error\n");
	      fprintf(mfp,"from %s\n",argv[1]);
	  fprintf(mfp,"to %s\n",buf);
	  if (ferror(mfp) || feof(mfp)) {


	/* If the loop quit, and  mfp  is not open,
	   no addresses were found.. */
	if (!mfp) exit(EX_DATAERR);

	/* Copy the original file into the spool as is.. */
	/* Start with eating the first "From " -line.. */
	while (1) {
	  int siz = fread(buf,1,sizeof(buf),stdin);
	  if (siz == 0) break;
	  if (fwrite(buf,1,siz,mfp) != siz) {
	if (ferror(stdin)) {
	if (feof(mfp) || ferror(mfp)) {
	return 0;