From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Noah Misch <noah(at)leadboat(dot)com> |
Cc: | Guillaume Lelarge <guillaume(at)lelarge(dot)info>, Benoit Lobréau <benoit(dot)lobreau(at)gmail(dot)com>, PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>, "Dr(dot) Michael Meskes" <michael(dot)meskes(at)credativ(dot)com> |
Subject: | Re: Probable memory leak with ECPG and AIX |
Date: | 2022-07-02 18:53:34 |
Message-ID: | 964681.1656788014@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Noah Misch <noah(at)leadboat(dot)com> writes:
> I had expected to use pthread_once() for the newlocale() call, but there would
> be no useful way to report failure and try again later. Instead, I called
> newlocale() while ECPGconnect() holds connections_mutex. See log message and
> comments for details. I tested "./configure ac_cv_func_uselocale=no ..." and
> tested the scenario of newlocale() failing every time.
This looks solid to me. The only nit I can find to pick is that I'd
have added one more comment, along the lines of
diff --git a/src/interfaces/ecpg/ecpglib/connect.c b/src/interfaces/ecpg/ecpglib/connect.c
index 9f958b822c..96f99ae072 100644
--- a/src/interfaces/ecpg/ecpglib/connect.c
+++ b/src/interfaces/ecpg/ecpglib/connect.c
@@ -508,6 +508,11 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
#ifdef ENABLE_THREAD_SAFETY
pthread_mutex_lock(&connections_mutex);
#endif
+
+ /*
+ * ... but first, make certain we have created ecpg_clocale. Rely on
+ * holding connections_mutex to ensure this is done by only one thread.
+ */
#ifdef HAVE_USELOCALE
if (!ecpg_clocale)
{
I've marked it RFC.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Geoghegan | 2022-07-02 18:54:16 | Re: AIX support - alignment issues |
Previous Message | Jeff Davis | 2022-07-02 18:39:04 | Re: Emit extra debug message when executing extension script. |