Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lnZBA-00072z-Q7 for pgsql-hackers@arkaria.postgresql.org; Mon, 31 May 2021 04:05:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lnZB9-0001rh-9V for pgsql-hackers@arkaria.postgresql.org; Mon, 31 May 2021 04:05:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lnZB9-0001rZ-1d for pgsql-hackers@lists.postgresql.org; Mon, 31 May 2021 04:05:27 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lnZB6-0003om-7p for pgsql-hackers@postgresql.org; Mon, 31 May 2021 04:05:26 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 14V45Cbu2522603; Mon, 31 May 2021 00:05:12 -0400 From: Tom Lane To: Michael Paquier cc: Justin Pryzby , Hubert Zhang , tsunakawa.takay@fujitsu.com, pgsql-hackers@postgresql.org, Andreas Seltenreich , Bruce Momjian Subject: Re: Multiple hosts in connection string failed to failover in non-hot standby mode In-reply-to: References: <229507.1610056206@sss.pgh.pa.us> <770711.1610318330@sss.pgh.pa.us> <20210506162651.GJ27406@telsasoft.com> <4170264.1620321747@sss.pgh.pa.us> <20210531012500.GP2082@telsasoft.com> Comments: In-reply-to Michael Paquier message dated "Mon, 31 May 2021 12:33:51 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2522601.1622433912.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 31 May 2021 00:05:12 -0400 Message-ID: <2522602.1622433912@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Michael Paquier writes: > In my recent quest to look at GSSAPI builds on Windows, I have bumped > into another failure that's related to this thread. hamerkop > summarizes the situation here: > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=3Dhamerkop&dt=3D= 2021-05-29%2010%3A15%3A42 > There are two failures like this one as errorMessage piles up on > failures, as of connect/test5: > -[NO_PID]: ECPGconnect: connection to server failed: FATAL: database > "regress_ecpg_user2" does not exist > +[NO_PID]: ECPGconnect: connection to server failed: could not > initiate GSSAPI security context: Unspecified GSS failure. Minor > code may provide more information: Credential cache is empty > +connection to server failed: FATAL: database "regress_ecpg_user2" > does not exist = Yeah, I was looking at that earlier today. Evidently libpq is trying a GSS-encrypted connection, and that doesn't work, so it falls back to a regular connection where we get the expected error. Probably all the connections in this test are hitting the GSS failure, but only the ones where the second attempt fails show a visible issue. What is not clear is why GSS is acting that way. We wouldn't have tried a GSS connection unless pg_GSS_have_cred_cache succeeded ... so how come that worked but then gss_init_sec_context complained "Credential cache is empty"? My rough guess is that Windows has implemented the GSS APIs in such a way that what pg_GSS_have_cred_cache is testing isn't sufficient to tell whether a sane credential actually exists. Or there's something particularly weird about how hamerkop is set up. regards, tom lane