Re: Interrupts vs signals

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, Andres Freund <andres(at)anarazel(dot)de>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: Interrupts vs signals
Date: 2026-11-27 20:44:07
Message-ID: e7a69938-1cc4-4360-b22f-f2be6e7fd774@iki.fi
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 12/11/2026 02:05, Zsolt Parragi wrote:
> Hello
>
> An automated claude review pointed out an issue caused by 2e2751e6976:
> it removed the SIGCHLD reset from PostgresMain(), but that code also
> ran for standalone backends, which never call InitPostmasterChild().
> postgres --single now keeps whatever SIGCHLD disposition it inherited,
> and if that is SIG_IGN, pclose() fails:
>
> $ python3 -c 'import os,signal,sys; signal.signal(signal.SIGCHLD,
> signal.SIG_IGN); os.execvp(sys.argv[1], sys.argv[1:])' \
> postgres --single -D data postgres
> backend> COPY (SELECT 1) TO PROGRAM 'cat > /dev/null';
> ERROR: could not close pipe to external command: No child processes
>
> The attached patch adds the same reset to InitStandaloneProcess().

Committed, thanks.

I keep forgetting about single-user mode. And it didn't occur to me that
postgres might get launched with SIGCHLD ignored.

- Heikki

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message Álvaro Herrera 2026-11-27 20:42:36 Re: Set 1s WaitLatch timeout if standby limit has expired in ResolveRecoveryConflictWithBufferPin