Re: [HACKERS] possible self-deadlock window after bad ProcessStartupPacket

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Nico Williams <nico(at)cryptonector(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Jimmy Yih <jyih(at)pivotal(dot)io>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] possible self-deadlock window after bad ProcessStartupPacket
Date: 2018-07-20 08:24:23
Message-ID: 2b5322bc-b95c-e4bf-e6ef-6983b553dd16@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 19/07/18 23:04, Nico Williams wrote:
> On Thu, Jun 22, 2017 at 03:10:31PM -0400, Tom Lane wrote:
>> Andres Freund <andres(at)anarazel(dot)de> writes:
>>> Or, probably more robust: Simply _exit(2) without further ado, and rely
>>> on postmaster to output an appropriate error message. Arguably it's not
>>> actually useful to see hundreds of "WARNING: terminating connection because of
>>> crash of another server process" messages in the log anyway.
>>
>> At that point you might as well skip the entire mechanism and go straight
>> to SIGKILL. IMO the only reason quickdie() exists at all is to try to
>> send a helpful message to the client. And it is helpful --- your attempt
>> to claim that it isn't sounds very much like wishful thinking.
>
> I dunno if it is or isn't helpful. But I do know that this must be done
> in an async-signal-safe way.
>
> Besides making ereport() async-signal-safe, which is tricky, you could
> write(2) the arguments to a pipe that another thread in the same process
> is reading from and which will then call ereport() and exit(3).

I don't see how that helps. It still wouldn't be safe for the other
thread to call ereport(), because the main thread might be in the middle
of calling ereport() itself.

- Heikki

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message AYahorau 2018-07-20 08:43:31 Adding TCP_USER_TIMEOUT support for libpq/psqlodbc
Previous Message Oskari Saarenmaa 2018-07-20 08:14:59 Re: pread() and pwrite()