supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: Charlie Brady <charlieb-supervision@budge.apana.org.au>
Cc: supervision@list.skarnet.org
Subject: Re: supervising postfix
Date: Sat, 16 Oct 2004 16:42:30 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.44.0410161632500.4200-100000@e-smith.charlieb.ott.istop.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0410161255440.4200-100000@e-smith.charlieb.ott.istop.com>


On Sat, 16 Oct 2004, Charlie Brady wrote:

> I don't see the logic in postfix interpreting this as a fatal error. 
> Postfix wanted to be the process group leader. It already was. Where's 
> the fatal problem?

I notice that elsewhere in postfix (in pipe_command.c) setsid failure is 
not fatal:

...
        /*
         * Child. Run the child in a separate process group so that the
         * parent can kill not just the child but also its offspring.
         */
    case 0:
        set_ugid(args.uid, args.gid);
        if (setsid() < 0)
            msg_warn("setsid failed: %m");
...

You could do the same in master.c:

...
    /*
     * Run in a separate process group, so that "postfix stop" can terminate
     * all MTA processes cleanly. Give up if we can't separate from our
     * parent process. We're not supposed to blow away the parent.
     */
    if (setsid() == -1)
        msg_fatal("unable to set session and process group ID: %m");
...

The comment of course is bogus, one wouldn't blow away the parent if 
setsid() fails, since that implies the parent is already in a separate 
process group.

BTW, don't expect to use multilog with postfix:

...                                                                                                    
    /*
     * If started from a terminal, get rid of any tty association. This also
     * means that all errors and warnings must go to the syslog daemon.
     */
    for (fd = 0; fd < 3; fd++) {
        (void) close(fd);
        if (open("/dev/null", O_RDWR, 0) != fd)
            msg_fatal("open /dev/null: %m");
    }
...

The comment there is also bogus, since there is not test for being started 
from a terminal.

---
Charlie



  parent reply	other threads:[~2004-10-16 20:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-16  4:35 Vincent Danen
2004-10-16 19:11 ` Charlie Brady
2004-10-16 19:28   ` Vincent Danen
2004-10-16 20:11     ` Charlie Brady
2004-10-16 23:37       ` Vincent Danen
2004-10-17  1:38         ` Vincent Danen
2004-10-16 20:42   ` Charlie Brady [this message]
2004-11-01 21:45   ` Csillag Tamas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.44.0410161632500.4200-100000@e-smith.charlieb.ott.istop.com \
    --to=charlieb-supervision@budge.apana.org.au \
    --cc=supervision@list.skarnet.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).