Wietse Venema:
> Victor Duchovni:
> > On Thu, Jan 07, 2010 at 01:25:01PM -0600, Wendigo Thompson wrote:
> > 
> > > Woops, I meant to say: message_size_limit is zero.
> > > 
> > > I went all verbose and looking at pickup logs for the specific queue
> > > ID I mentioned earlier:
> > > Jan  7 13:16:20 se001 postfix/pickup[57270]: warning: C9EBD24E12F23:
> > > message has been queued for 521 days
> > > Jan  7 13:16:20 se001 postfix/pickup[57270]: C9EBD24E12F23: uid=27
> > > from=<> orig_id=F423E1976D72
> > > Jan  7 13:16:20 se001 postfix/cleanup[75242]: C9EBD24E12F23:
> > > message-id=<11eccdf1ff78c949b5011f37ba264e4619d4d...@10.1.1.1>
> > > 
> > > After that all references to the new queue entry cease, and a minute
> > > later the process starts over again with the original queue id
> > > appearing to get a new ID, the warning about the message being queued
> > > (as little as 2 days and as long as 521, depending on the message).  I
> > > never see a delivery message -- which I see plenty of for other
> > > messages coming in in real time.
> 
> I recall that this message has no recipient (you moved the message
> with "postsuper -r" back to the maildrop queue).
> 
> In that case the message is "in error" and it should be skipped
> and deleted. Since Postfix does accept mail without recipients,
> this file probably triggers some anomaly somewhere.

This patch should deal with messages that are requeued after all
their recipients are already delivered (or bounced).

        Wietse

*** ./pickup.c- Fri Apr 17 16:03:58 2009
--- ./pickup.c  Thu Jan  7 15:06:11 2010
***************
*** 157,162 ****
--- 157,163 ----
      struct stat st;                   /* queue file status */
      char   *path;                     /* name for open/remove */
      char   *sender;                   /* sender address */
+     int     rcpt_count;                       /* todo recipients */
  } PICKUP_INFO;
  
   /*
***************
*** 255,260 ****
--- 256,263 ----
            if (type == REC_TYPE_RDR)
                /* Discard REDIRECT record after "postsuper -r". */
                continue;
+           if (type == REC_TYPE_RCPT)
+               info->rcpt_count++;
        }
        if (*expected == REC_TYPE_EXTRACT[0]) {
            if (type == REC_TYPE_RRTO)
***************
*** 384,389 ****
--- 387,399 ----
        return (status);
  
      /*
+      * If we found no recipients, assume that this was a requeued message
+      * that was not deleted because the queue manager was restarted.
+      */
+     if (info->rcpt_count == 0)
+       return (REMOVE_MESSAGE_FILE);
+ 
+     /*
       * There are no errors. Send the end-of-data marker, and get the cleanup
       * service completion status. XXX Since the pickup service is unable to
       * bounce, the cleanup service can report only soft errors here.
***************
*** 486,491 ****
--- 496,502 ----
      info->id = 0;
      info->path = 0;
      info->sender = 0;
+     info->rcpt_count = 0;
  }
  
  /* pickup_free - wipe info structure */

Reply via email to