Re: pgsql: Add WL_EXIT_ON_PM_DEATH pseudo-event.

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: Christoph Berg <myon(at)debian(dot)org>, Thomas Munro <tmunro(at)postgresql(dot)org>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pgsql: Add WL_EXIT_ON_PM_DEATH pseudo-event.
Date: 2018-11-24 23:59:37
Message-ID: CAEepm=2Lx9-RACBhMpBp-FR9X9=45B8aqVo7pNn-362FZrxkxQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Sun, Nov 25, 2018 at 3:38 AM Christoph Berg <myon(at)debian(dot)org> wrote:
> Re: Thomas Munro 2018-11-23 <E1gQ6IU-0002sR-Fm(at)gemulon(dot)postgresql(dot)org>
> > Add WL_EXIT_ON_PM_DEATH pseudo-event.
>
> I think this broke something:
>
> TRAP: FailedAssertion(»!(!IsUnderPostmaster || (wakeEvents & (1 << 5)) || (wakeEvents & (1 << 4)))«, Datei: »/build/postgresql-12-JElZNq/postgresql-12-12~~devel~20181124.1158/build/../src/backend/storage/ipc/latch.c«, Zeile: 389)
> 2018-11-24 15:20:43.193 CET [17834] LOG: Serverprozess (PID 18425) wurde von Signal 6 beendet: Aborted
>
> I can trigger it just by opening an ssl connection, non-ssl tcp
> connections are fine.

Thanks. I was initially surprised that this didn't come up in
check-world, but I see now that I need to go and add
PG_TEST_EXTRA="ssl ldap" to my testing routine (and cfbot's).
Reproduced here, and it's a case where we were not handling postmaster
death, which exactly what this assertion was designed to find. The
following is one way to fix the assertion failure, though I'm not sure
if it would be better to request WL_POSTMASTER_DEATH and generate a
FATAL error like secure_read() does:

--- a/src/backend/libpq/be-secure-openssl.c
+++ b/src/backend/libpq/be-secure-openssl.c
@@ -406,9 +406,9 @@ aloop:
* StartupPacketTimeoutHandler() which
directly exits.
*/
if (err == SSL_ERROR_WANT_READ)
- waitfor = WL_SOCKET_READABLE;
+ waitfor = WL_SOCKET_READABLE |
WL_EXIT_ON_PM_DEATH;
else
- waitfor = WL_SOCKET_WRITEABLE;
+ waitfor = WL_SOCKET_WRITEABLE
| WL_EXIT_ON_PM_DEATH;

--
Thomas Munro
http://www.enterprisedb.com

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2018-11-25 05:35:19 pgsql: Fix assertion failure for SSL connections.
Previous Message Andrew Gierth 2018-11-24 21:21:01 pgsql: Fix hstore hash function for empty hstores upgraded from 8.4.

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2018-11-25 00:17:27 Re: tab-completion debug print
Previous Message Peter Geoghegan 2018-11-24 23:13:42 Re: Making all nbtree entries unique by having heap TIDs participate in comparisons