On Wed, Aug 31, 2011 at 07:58:55PM -0400, Wietse Venema wrote:

> > This is extremely difficult to reproduce, but it does happen occasionally 
> > -- We will tell postfix to stop, and once that is complete, a "postdrop" 
> > process will sometimes remain, and will run until it is manually killed.
> > 
> > Is this an expected behavior of postdrop -- That after the master postfix 
> > is stopped, it is expected sometimes that it may continue running, 
> > regardless?
> 
> This is 100% intentional. The Postfix sendmail command MUST NOT
> drop mail on the floor while the mail system is down.

Well, yes, postdrop(1) is expected to reliably enqueue mail, even when
the mail system is down. This said, it is not really expected to enter
an infinite loop!

On Wed, Aug 31, 2011 at 04:36:22PM -0700, Quanah Gibson-Mount wrote:

> This is extremely difficult to reproduce, but it does happen
> occasionally -- We will tell postfix to stop, and once that is
> complete, a "postdrop" process will sometimes remain, and will run
> until it is manually killed.
> 
> Is this an expected behavior of postdrop -- That after the master
> postfix is stopped, it is expected sometimes that it may continue
> running, regardless?

Normally, postdrop(1) will enqueue the message and exit, whether the
mail system is up or not. The only plausible failure reason is inability
to access the "maildrop" directory, either because the setgid bit has
been cleared on the postdrop(1) binary, or because the directory has
been moved, deleted, modified to not allow group write access, ...

So the question is what is it that is causing postdrop to loop while
trying to create the queue file?

    /*
     * Create a file with a temporary name that does not collide. The process
     * ID alone is not sufficiently unique: maildrops can be shared via the
     * network. Not that I recommend using a network-based queue, or having
     * multiple hosts write to the same queue, but we should try to avoid
     * losing mail if we can.
     *
     * If someone is racing against us, try to win.
     */
    for (;;) {
        GETTIMEOFDAY(tp);
        vstring_sprintf(temp_path, "%s/%d.%d", queue_name,
                        (int) tp->tv_usec, pid);
        if ((fd = open(STR(temp_path), O_RDWR | O_CREAT | O_EXCL, mode)) >= 0)
            break;
        if (errno == EEXIST || errno == EISDIR)
            continue;
        msg_warn("%s: create file %s: %m", myname, STR(temp_path));
        sleep(10);
    }

Are the "create file" warnings found in the system log?

-- 
        Viktor.

Reply via email to