Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r96vO-00EEyd-UO for pgsql-general@arkaria.postgresql.org; Fri, 01 Dec 2023 17:03:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1r96vN-008asR-LS for pgsql-general@arkaria.postgresql.org; Fri, 01 Dec 2023 17:03:33 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r96uf-008WZQ-AW for pgsql-general@lists.postgresql.org; Fri, 01 Dec 2023 17:02:49 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r96uc-008IsA-6f for pgsql-general@postgresql.org; Fri, 01 Dec 2023 17:02:47 +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 3B1H2hrO116316; Fri, 1 Dec 2023 12:02:43 -0500 From: Tom Lane To: John DeSoi cc: Joe Conway , Postgres General Subject: Re: libpq crashing on macOS during connection startup In-reply-to: <0100018c25ba1137-7735f30f-0938-458b-992b-60369d534db0-000000@email.amazonses.com> References: <0100018c20b152e0-ec85ac20-b379-46d7-a962-c59e00f3201c-000000@email.amazonses.com> <96e41ee8-a1b6-4bf9-82b5-1c0fd2d5502a@joeconway.com> <0100018c20c97a5e-2aa47402-cd8c-4548-bbd3-b17d10020b39-000000@email.amazonses.com> <508800.1701374869@sss.pgh.pa.us> <0100018c22fc6f53-68a3de31-0c8c-4305-a889-fb23b5732596-000000@email.amazonses.com> <12250.1701395631@sss.pgh.pa.us> <0100018c25ba1137-7735f30f-0938-458b-992b-60369d534db0-000000@email.amazonses.com> Comments: In-reply-to John DeSoi message dated "Fri, 01 Dec 2023 14:13:20 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <116314.1701450163.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 01 Dec 2023 12:02:43 -0500 Message-ID: <116315.1701450163@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk John DeSoi writes: >> On Nov 30, 2023, at 7:53 PM, Tom Lane wrote: >> Ugh, not only Heimdal but a very obsolete version thereof? It borders >> on negligence for the homebrew PG package to be building against that. >> They should be pulling in homebrew's MIT Kerberos package and using >> that, if they want to enable GSSAPI. > I was looking at the homebrew source for PostgreSQL package to see if th= ere was a way to customize the build options. I did not find one but saw t= he comment below. Apparently this is a known issue and it was suggested to= use the MIT Kerberos package 4 years ago. Instead they just added this co= mment in 2020. > # GSSAPI provided by Kerberos.framework crashes when forked. > # See https://github.com/Homebrew/homebrew-core/issues/47494. Oh, thanks for finding that. But you misinterpreted the outcome; the commit that closed that thread did +# GSSAPI provided by Kerberos.framework crashes when forked. +# See https://github.com/Homebrew/homebrew-core/issues/47494. +depends_on "krb5" The "depends_on" was evidently meant to force building against krb5, and I suppose it did have that effect when committed. Could they have done something since then to break it? Looking closer, your stack trace seems to show that libpq *is* linked against MIT Kerberos: at least, control flows from libpq.5.dylib to libgssapi_krb5.2.2.dylib, which is not a library that Apple supplies. However, then a few subroutines further deep, we somehow end up in Apple's Kerberos framework, and that eventually calls libdispatch which is the source of the problem according to the discussion in issues/47494. My guess at this point is that somebody at Homebrew put in a hack (perhaps quite recently) that causes their build of MIT Kerberos to sometimes call Apple's implementation, and that ill-advised idea has re-opened the problem that issues/47494 meant to solve. I'd suggest filing a bug against Homebrew's krb5 package. Whatever this is, it seems pretty clear that it's not a Postgres bug. regards, tom lane