Re: [EXTERNAL] Re: Windows Application Issues | PostgreSQL | REF # 48475607

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Sandeep Thakkar <sandeep(dot)thakkar(at)enterprisedb(dot)com>
Cc: "Haifang Wang (Centific Technologies Inc)" <v-haiwang(at)microsoft(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Rahul Pandey <pandeyrah(at)microsoft(dot)com>, Vishwa Deepak <Vishwa(dot)Deepak(at)microsoft(dot)com>, Shawn Steele <Shawn(dot)Steele(at)microsoft(dot)com>, Amy Wishnousky <amyw(at)microsoft(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>, Shweta Gulati <gulatishweta(at)microsoft(dot)com>, Ashish Nawal <nawalashish(at)microsoft(dot)com>
Subject: Re: [EXTERNAL] Re: Windows Application Issues | PostgreSQL | REF # 48475607
Date: 2024-10-05 01:16:31
Message-ID: CA+hUKGLqN3dhHF_Y6rEgKCVxy0f7uCtSEv7okAzz=D96qVj38Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Sep 20, 2024 at 11:37 AM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
> If I don't hear any objections to this plan soon, I'm going to commit
> this and back-patch it into PostgreSQL 16 and PostgreSQL 17 after the
> upcoming code freeze for the PostgreSQL 17 release ends. So it'll
> probably be in 16.5 and 17.1.

Done, after another round of polishing and testing.

The main change since v2 was: I realised that initdb's
locale_date_order() also contains a save-and-restore, which should
share code at least for consistency (I don't personally know which
categories really affect process-wide encoding assumptions, so this
might not technically be necessary). I moved the relevant code into
new helper functions, which I think came out tidier.

The wchar_t-based save-restore in initdb.exe is based on a theoretical
observation, as the report was about postgres.exe crashing and that
should now be unreachable with these new name checks, but we can see
the general phenomenon from a two-line standalone repro[1] and so I
suspect there must be environment/input combinations that could crash
initdb.exe itself without it. We don't have any concrete reports of
that, but I preferred to close the theoretical risk using the
recommended technique.

Sorry for taking so long to untangle this mess; I assumed for much of
the thread that we were talking about the failure of existing clusters
to come up (as complained about in numerous other threads), not this
new kind of crash, and was trying to fix that before the Locale
Builder solution was widely known. Fixing Windows bugs as a
non-Windows guy by reading the manual and testing patches on CI can
sometimes feel a little like trying to patch a Mars rover... Thanks
to David R for help with a crucial observation using a martian
debugger.

CREATE COLLATION should probably also start using check_locale()
eventually, and I may look into harmonising that and figure out how to
test it in nearby future work on locales vs threads.

[1] https://www.postgresql.org/message-id/CA+hUKG+FxeRLURZ=n8NPyLwgjFds_SqU_cQvE40ks6RQKUGbGg@mail.gmail.com

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Thomas Munro 2024-10-05 01:40:17 Re: PostgreSQL 17 Segmentation Fault
Previous Message Cameron Vogt 2024-10-04 22:17:47 Re: PostgreSQL 17 Segmentation Fault