Re: pgsql: Add WL_EXIT_ON_PM_DEATH pseudo-event. - Mailing list pgsql-hackers

From Thomas Munro
Subject Re: pgsql: Add WL_EXIT_ON_PM_DEATH pseudo-event.
Date
Msg-id CAEepm=2Lx9-RACBhMpBp-FR9X9=45B8aqVo7pNn-362FZrxkxQ@mail.gmail.com
Whole thread Raw
In response to Re: pgsql: Add WL_EXIT_ON_PM_DEATH pseudo-event.  (Christoph Berg <myon@debian.org>)
Responses Re: pgsql: Add WL_EXIT_ON_PM_DEATH pseudo-event.
List pgsql-hackers
On Sun, Nov 25, 2018 at 3:38 AM Christoph Berg <myon@debian.org> wrote:
> Re: Thomas Munro 2018-11-23 <E1gQ6IU-0002sR-Fm@gemulon.postgresql.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


pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Making all nbtree entries unique by having heap TIDs participatein comparisons
Next
From: David Fetter
Date:
Subject: Re: tab-completion debug print