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 1lxGgW-0003iP-VG for pgsql-hackers@arkaria.postgresql.org; Sat, 26 Jun 2021 22:21:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lxGgU-0007gM-SK for pgsql-hackers@arkaria.postgresql.org; Sat, 26 Jun 2021 22:21:54 +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 1lxGgU-0007gE-Kf for pgsql-hackers@lists.postgresql.org; Sat, 26 Jun 2021 22:21:54 +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 1lxGgS-0002tf-Ny for pgsql-hackers@postgresql.org; Sat, 26 Jun 2021 22:21:54 +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 15QMLnuL3131386; Sat, 26 Jun 2021 18:21:49 -0400 From: Tom Lane To: Michael Paquier cc: Jacob Champion , "pgsql-hackers@postgresql.org" , Daniel Gustafsson Subject: Re: [PATCH] Make jsonapi usable from libpq In-reply-to: <3122443.1624735363@sss.pgh.pa.us> References: <3045186.1624729430@sss.pgh.pa.us> <3122443.1624735363@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Sat, 26 Jun 2021 15:22:43 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3131384.1624746109.1@sss.pgh.pa.us> Date: Sat, 26 Jun 2021 18:21:49 -0400 Message-ID: <3131385.1624746109@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I wrote: > Not real sure what to do about PGTHREAD_ERROR. I wonder if we shouldn't simply nuke that macro and change the call sites into "Assert(false)". The only call sites are in default_threadlock() (used in fe_auth.c) and pq_lockingcallback() (for OpenSSL). I suggest that 1. "fprintf(stderr)" in these locking functions doesn't seem remarkably well-advised either. Especially not on Windows; but in general, we don't expect libpq to emit stuff on stderr except under *very* limited circumstances. 2. In an assert-enabled build, Assert() ought to be about equivalent to abort(). 3. In a production build, if one of these mutex calls fails, ignoring the failure might be the best thing to do anyway. Certainly, dumping core is the worst possible outcome, while not doing anything would have no impact except in the rather-unlikely case that multiple libpq connections try to use this code concurrently. It's certainly possible to quibble about point 3, but unless you have a better alternative to offer, I don't think you have a lot of room to complain. regards, tom lane