Re: BUG in pg_autovacuum - with patch - Mailing list pgsql-bugs

From Matthew T. O'Connor
Subject Re: BUG in pg_autovacuum - with patch
Date
Msg-id 424E409B.7080307@zeut.net
Whole thread Raw
In response to BUG in pg_autovacuum - with patch  (Karl Denninger <karl@denninger.net>)
Responses Re: BUG in pg_autovacuum - with patch
List pgsql-bugs
Why would you run pg_autovacuum from cron?

Karl Denninger wrote:

>Hi folks.
>
>There's a problem in the console detach code for pg_autovacuum.
>
>"setsid()" is NOT sufficient.  Specifically, you must disassociate the
>control terminal (standard in, out and error) for it to be complete.
>
>This causes any attempt to execute pg_autovacuum from the cron to hang the
>cron processor, stalling it.
>
>Find below a diff that fixes the problem and allows proper disassociation:
>
>
>*** pg_autovacuum.c.old    Fri Apr  1 21:13:22 2005
>--- pg_autovacuum.c    Fri Apr  1 20:55:41 2005
>***************
>*** 196,201 ****
>--- 196,202 ----
>  daemonize(void)
>  {
>      pid_t        pid;
>+     int        i;
>
>      pid = fork();
>      if (pid == (pid_t) -1)
>***************
>*** 219,224 ****
>--- 220,230 ----
>          fflush(LOGOUTPUT);
>          _exit(1);
>      }
>+     i = open(NULL_DEV, O_RDWR);
>+         dup2(i, 0);
>+         dup2(i, 1);
>+         dup2(i, 2);
>+         close(i);
>  #endif
>
>  }
>
>
>--
>
>

pgsql-bugs by date:

Previous
From: "T.J."
Date:
Subject: Windows compilation
Next
From: Karl Denninger
Date:
Subject: Re: BUG in pg_autovacuum - with patch