From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Fix ancient bug in ecpg's pthread_once() emulation for Windows. |
Date: | 2020-10-24 17:13:34 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Fix ancient bug in ecpg's pthread_once() emulation for Windows.
We must not set the "done" flag until after we've executed the
initialization function. Otherwise, other threads can fall through
the initial unlocked test before initialization is really complete.
This has been seen to cause rare failures of ecpg's thread/descriptor
test, and it could presumably cause other sorts of misbehavior in
threaded ECPG-using applications, since ecpglib relies on
pthread_once() in several places.
Diagnosis and patch by me, based on investigation by Alexander Lakhin.
Back-patch to all supported branches (the bug dates to 2007).
Discussion: https://postgr.es/m/[email protected]
Branch
------
REL_11_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/12a73f29ff7d00ea96ec4c5d1bef9acb5985d688
Modified Files
--------------
src/interfaces/ecpg/ecpglib/misc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From | Date | Subject | |
---|---|---|---|
Next Message | David Rowley | 2020-10-25 09:40:45 | pgsql: Fix incorrect parameter name in a function header comment |
Previous Message | Michael Paquier | 2020-10-24 05:22:58 | pgsql: Fix issue with --enable-coverage and the new unicode {de,re}comp |