Re: Fwd: Default pg_autovacuum config glitches

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: "Matthew T(dot) O'Connor" <matthew(at)zeut(dot)net>
Cc: Bruno Wolff III <bruno(at)wolff(dot)to>, 225680(at)bugs(dot)debian(dot)org, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Fwd: Default pg_autovacuum config glitches
Date: 2004-03-27 16:43:18
Message-ID: 20040327083842.N99775@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, 26 Mar 2004, Matthew T. O'Connor wrote:

> Bruno Wolff III wrote:
>
> >On Thu, Mar 25, 2004 at 16:08:49 +0100,
> > Martin Pitt <martin(at)piware(dot)de> wrote:
> >
> >
> >>A while ago we received the bug report below against pg_autovacuum.
> >>Since it runs as a daemon, it should detach from its controlling
> >>terminal by executing sth like
> >>
> >> int nullfd = open("/dev/null", O_RDWR);
> >> dup2(nullfd, 0);
> >> dup2(nullfd, 1);
> >> dup2(nullfd, 2);
> >> if (nullfd != 0 && nullfd != 1 && nullfd != 2)
> >> close(nullfd);
> >>
> >>(taken from syslog-ng which does it properly).
> >>
> >>
> >
> >That doesn't look like a good idea. This will prevent any logging to
> >stdout or stderr.
> >
> >If you don't want that ability you can redirect the stdin, stdout and
> >stderr yourself.
> >
>
> I have stayed quiet about this since I wanted to hear what others
> thought of the above suggest fix. I took the detach code straight from
> the postmaster daemonize function. Perhaps I didn't do something right

The postmaster's seems to have a section that does a null device open,
dup2s and a close at the end of pmdaemonize in the 7.4 and 7.5 versions on
my box:

i = open(NULL_DEV, O_RDWR | PG_BINARY);
dup2(i, 0);
dup2(i, 1);
dup2(i, 2);
close(i);

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2004-03-27 18:35:37 Re: Fwd: Default pg_autovacuum config glitches
Previous Message Bruno Wolff III 2004-03-27 06:12:38 Re: Bug#225680: Fwd: Default pg_autovacuum config glitches