Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1icaAY-0002hX-R9 for pgsql-bugs@arkaria.postgresql.org; Wed, 04 Dec 2019 19:18:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1icaAW-0007Ly-F1 for pgsql-bugs@arkaria.postgresql.org; Wed, 04 Dec 2019 19:18:36 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1icaAV-0007Lr-Qs for pgsql-bugs@lists.postgresql.org; Wed, 04 Dec 2019 19:18:36 +0000 Received: from mail-oi1-x231.google.com ([2607:f8b0:4864:20::231]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1icaAS-0003Uo-TS for pgsql-bugs@lists.postgresql.org; Wed, 04 Dec 2019 19:18:34 +0000 Received: by mail-oi1-x231.google.com with SMTP id l136so338790oig.1 for ; Wed, 04 Dec 2019 11:18:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crunchydata-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=2QGwBjR3BeNV6jbSE5Aoc1RTAdUKz+u+xC2VGx9PNwo=; b=0FI3Bc23MPeySRekkuRvVKJOiKghrxtLI7niVZYGdYDEA0AmWKes04GB+e6brqssNQ fomfFl5y7KT+QEO3avWReAXr42ACnJ1S1ZYp1+jNlDLcLANBcqjPsQYsdxi2DHWykK35 2E+k5RidqMJosj/lndhfO138cbNNN305ImQH9aNMbHSzvkt3hV/xpV9UTJVPsAC/tU+y L7Cyli6nx29rEpbI6JpGOwnm5pEZHnr5XgzH4W6KI6ssb3Yuk4pd/sjaG/7y+WcjwjFJ +4rTmi6rVx8x0BjO3edYdWehetnhHwtMaVGpobC9GTv+hU/WQJ53G7xYBfL9MnpzJohC VV/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=2QGwBjR3BeNV6jbSE5Aoc1RTAdUKz+u+xC2VGx9PNwo=; b=VvZ0W+QsvpCqRp8GEqBXLEz2hVcnhyBLjhFGrHDH86/+R1YX1g0xDbvQ8AI++QA/Fh cyQp8SOjcpB1hWlbG4IupnL3HSlSw9yrI0+cT59Mb5DIP/4sBvNO5QDDup/ecAQzol2D dYz44YhC8gUnQy5GrD3JcnAld+l+wUtzmIMctqiyXLrXssDaqF/LljlgcbZdu4KXnkKg Ufz7udgA3oKXfZDATmoYsnSqbfTdoKNY30xZ+fNVZxEv62QXDKtSRmjiFFz9Xgl06eGE zEY5XGSg0hteucQWjjDg7y/AGOM3GCwG5JNB38+N1wsOY8XfVdDNBRWs+i5Kiv3bb0lI m7vw== X-Gm-Message-State: APjAAAWOdRxAD/n5vNNZwY4NFG7uNYxNB6fALgNhv6VfFOAIrDlH0tAs eQveplvY0ySWVnottzvd+HP9Abql/yE= X-Google-Smtp-Source: APXvYqxJpI9JIzbr+1MKsJPVNex//bA+z+MtQI9azIUvuN4cx/UyC+z4rwrYEXxkPe6NaQaI4S0+tQ== X-Received: by 2002:aca:d783:: with SMTP id o125mr4089573oig.68.1575487111929; Wed, 04 Dec 2019 11:18:31 -0800 (PST) Received: from Chriss-MacBook-Pro.local (cpe-70-119-109-50.tx.res.rr.com. [70.119.109.50]) by smtp.gmail.com with ESMTPSA id w2sm2467635otp.55.2019.12.04.11.18.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Dec 2019 11:18:31 -0800 (PST) Subject: Re: BUG #16041: Error shows up both in pgAdmin and in Ruby (pg gem) - Segmentation fault To: Stephen Frost Cc: mark.siemers@gmail.com, pgsql-bugs@lists.postgresql.org References: <16041-b44f9931ad91fc3d@postgresql.org> <93f7379b-2e2f-db0c-980e-07ebd5de92ff@crunchydata.com> <20191203233132.GZ6962@tamriel.snowman.net> From: Chris Bandy Message-ID: <94f70eee-eb72-88d7-ff8f-53cfbe130a69@crunchydata.com> Date: Wed, 4 Dec 2019 13:18:30 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20191203233132.GZ6962@tamriel.snowman.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 12/3/19 5:31 PM, Stephen Frost wrote: > Greetings, > > * Chris Bandy (chris.bandy@crunchydata.com) wrote: >> Notice that host must be a TCP address (not Unix) and gssencmode must be >> "prefer" (default is "prefer".) The version of the server doesn't appear to >> matter; I tested 10, 11, and 12. > > So, gssencmode didn't exist in 10 or 11- but are you actually testing > those different versions of *libpq*? No, the libpq version in my tests is always 12. I was trying to say that it doesn't appear to be an issue with the protocol/negotiation of GSS encryption. That does make me wonder, though, if/how the _server_ built by `brew install postgresql` might be impacted by the macOS GSSAPI? All my tests targeted a linux server. >> This has been reported in a variety of Ruby projects and often dismissed as >> "a PostgreSQL issue." > > I'm really inclined to say that this isn't a PG issue... I agree, but at the same time the perception seems to be that using/connecting to PostgreSQL crashes one's application. I think the very reasonable default of gssencmode=prefer is partly responsible. Users don't realize that by upgrading libpq they are opting in to new security code paths (and library compatibility issues.) > Unfortunately, MacOS is pretty well known to be terrible about less > commonly used libraries and maintaining them. I'd suggest building a > current version of the Kerberos libraries, making sure you're linking > against just those and not whatever is provided by MacOS, and see if you > still have an issue. Investigating this has been the deepest exposure I've had to this... yes, "unfortunate" reality. Homebrew provides a recent version of krb5 (1.17 at this time) so I set out to use it. A small diff to the formula proved successful. I'll submit a patch to Homebrew linking back to this thread. Is there anything that can/should be done on PostgreSQL's end now that we know about this situation? The most I can imagine is to issue a warning when macOS's GSSAPI is detected during build/configure. I don't know how to do the latter and won't be surprised if the answer to the former is "no." > The other possibility is that this is an current bug in Heimdal, which > seems to be the Kerberos library being used on MacOS, in which case > you'd need to bring up the issue with them. I'm out of my depth on this front. My impression from the traces is that the incompatibility is in macOS keychain, and I'm willing to leave it at that. While researching this topic, I found multiple cases where fork() and the "dispatch queue" are incompatible.[1] > There seems to be some indepedent confirmation of this being an issue > with the Heimdal provided by MacOS: > > https://github.com/zenchild/gssapi/issues/12 I don't see any C level backtrace information in that thread, so I can't tell if its the same issue. Thank you for your help! Chris [1]: https://www.evanjones.ca/fork-is-dangerous.html