Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fyj4r-0002Qm-L5 for pgsql-bugs@arkaria.postgresql.org; Sat, 08 Sep 2018 19:39:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fyj4p-00084y-Kg for pgsql-bugs@arkaria.postgresql.org; Sat, 08 Sep 2018 19:39:27 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fyj4p-00084r-Az for pgsql-bugs@lists.postgresql.org; Sat, 08 Sep 2018 19:39:27 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fyj4m-0000MK-TA for pgsql-bugs@lists.postgresql.org; Sat, 08 Sep 2018 19:39:26 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 40EB620A70; Sat, 8 Sep 2018 15:39:24 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sat, 08 Sep 2018 15:39:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=J+Y3zwqxxDRWiNJfvwHOjcsKAfnieymE6U1D8R1h9l0=; b=v+DCwpqH 9TG8/E/wfHfBTgQQkYlypqZm8JD9KUW25pGGMfAGoFHuJ+sVSmCe+WApo0rEaXQ6 7mV1nr7Eg94eOKH68i7gt/jd4a1thw+bFYjsPxhSaRLOwbsrx7d8UFIF3M86Tx1s MA1iY9U+XtZ5alZX/C/P5fV7gsmZ3aWhHBVDTltNK4XZXFMdvsPHGuVhx9FzFHDq 6iWOksKE2Zb5e/ZdwQy8Bmil7+AHgDVz9yJYqDuZhTksmD4McDMBECrj++evJYQJ 86RidArlq5cBPt630TV4WCAEJ/32dsJ3I0toe4BxId4+Qst0kI3WyogEqyLUHRwA t3TAgxkL8twGNQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; bh=J+Y3zwqxxDRWiNJfvwHOjcsKAfnie ymE6U1D8R1h9l0=; b=JnZ7cKGffdcYPKwiZT2uz7XKezFYzFTVNuKmdRWRSkXc4 tkkuDpdnAV3brrBEpLJ4TxR9PPzo7c+X03wuyDstq//eloIKU9BLUBiPUyjmqBqE iL5chfMfSrkeTdjCV01YG2zQTezGTJdWWbMT86zHiqDOWCY6YxqM0m3EDwgsjGl+ 9hpx0ET/HymV5vGFHc0QPsdgVVXKKI9pkOeJOxkx936O2C/4h3eaOztreTov+pwn izcrBVawr+U1DMndhiGLSZ7ulk0xeT0JqXoQZ00lCXgZKVg7ufLYiL7260nYwPvE Wr56uzDN6HAqNRXUk/IUKsG0BmjqLmV5cjt2vqWRQ== X-ME-Proxy: X-ME-Sender: Received: from paquier.xyz (unknown [216.9.110.14]) by mail.messagingengine.com (Postfix) with ESMTPA id DCDBF10292; Sat, 8 Sep 2018 15:39:22 -0400 (EDT) Date: Sat, 8 Sep 2018 12:39:14 -0700 From: Michael Paquier To: Tom Lane Cc: Andrew Gierth , Jeremy Evans , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15367: Crash in pg_fe_scram_free when using foreign tables Message-ID: <20180908193914.GI32058@paquier.xyz> References: <20180906222843.GF17425@jeremyevans.local> <20180907165103.GH17425@jeremyevans.local> <20180907175518.GI17425@jeremyevans.local> <20180907181522.GB32058@paquier.xyz> <20016.1536351535@sss.pgh.pa.us> <20180907204403.GC32058@paquier.xyz> <16558.1536407783@sss.pgh.pa.us> <18398.1536410055@sss.pgh.pa.us> <87o9d8rv08.fsf@news-spur.riddles.org.uk> <3979.1536433320@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="9s922KAXlWjPfK/Q" Content-Disposition: inline In-Reply-To: <3979.1536433320@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --9s922KAXlWjPfK/Q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Sep 08, 2018 at 03:02:00PM -0400, Tom Lane wrote: > I tried setting up a scram-auth-based postgres_fdw connection on > my RHEL6 box and forcing it through the questionable code path > by issuing a dummy ALTER USER MAPPING command from another session. > It worked fine, so the problem doesn't seem to be present on Linux. >=20 > Repeating the same thing on a nearby OpenBSD 6.0 image ... kaboom! > It fails exactly as Jeremy describes. Furthermore, I can confirm > that the attached patch fixes it. That's not good! I have tried the report on Linux only, with pgbench -C doing many foreign scans through postgres_fdw which connects to the remote using SCRAM authentication, and this was stable. Anything newer than ec136d19 is impacted. I am surprised this has not been seen earlier to be honest. > I wonder which other platforms we have that behave like this? > And how come we've not seen symptoms before? It's hard to believe > that src/common/saslprep.c is the only thing libpq imports > that has FRONTEND-vs-not-FRONTEND behavior differences. libpq is quite particular in the fact that it compiles directly with stuff in src/common, src/port, etc. I think that the same problem exists for pg_md5_encrypt(). So I like the solution proposed. I guess you have made sure that postgres_fdw becomes stable this way? Have you tried to stress it more with pgbench -C doing only foreign scans and dozens of clients running in parallel? -- Michael --9s922KAXlWjPfK/Q Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAluUJWIACgkQnvQgOdby QH3iOhAAgNiCyEfVjTsnK1NKOz/E43mwdJwae9JvrxuGqv39hqTCwcjs3MBbd8r0 Ij2SUFioyp4EIlEVNQJJQgweAmHLGuPDOp+wWmnNX2vmn+Bl8oqFD8TkiY0x5bQM R4ro2YfJrrjRkPTnnk6mI7N0n4fIEC6HMAdg7TNi0DQq7fad6BA2aIvy9PqnUya/ mxKASYrzi/h0UDVBOJc66Ylh6h0KYcvjpPfYhVwMbYk5FC5EmQd6405bp8Ai4IAt r5pQVMd6f3T0y93BfLmgWP+XaGyNlM1HFix85xRPi0skR/WZ2ehL0j8QF6c3mT3q B1bk4PcN7tawlN1M+vu0/7Xa7CxcZAHFDiYD8k1z6j3A6yi1RXnNdNyJqLURKtMH JMR2+JJEIAtAGdd/PLDQEjmImrltuQ2/wfB5099TLbIU17+Q181lkI2aT4qOL+dK wlEzIC7mPtlm47lAhgH+U1skvt+j7VWOJqALumyjyTTjoQJyA8bBLQH9s1R8+ftY zAuhLQ3XmDHi3gggT4RF+YKtOxVuCg4/GEfO1X9sXImvmd1qleBrQB3yGkyV+LEj ZaZp62IzE4lBAwE9z1UAH2M3LlJ/lD96BPLLG8YNX1UiKZPY9qmALR471pVO41qD nVqPcP1V/edCT+2Xo4n0NdZvI2BihXEjg/aLCTeiBDdpyQFCJPE= =p3uS -----END PGP SIGNATURE----- --9s922KAXlWjPfK/Q--