Re: orangutan seizes up during isolation-check

From: Noah Misch <noah(at)leadboat(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, davec(at)postgresintl(dot)com, hlinnakangas(at)vmware(dot)com
Subject: Re: orangutan seizes up during isolation-check
Date: 2014-10-11 05:41:53
Message-ID: 20141011054153.GA30658@tornado.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Oct 10, 2014 at 09:14:38PM -0400, Peter Eisentraut wrote:
> On 10/10/14 8:24 PM, Noah Misch wrote:
> > Here's an implementation thereof covering both backend and frontend use of
> > setlocale(). A setlocale() wrapper, pg_setlocale(), injects use of the child
> > process where necessary.
>
> Would such a change not be better in gnulib itself?

Good question. It would be nice to make the change there, for the benefit of
other consumers. The patch's setlocale_native_forked() assumes it never runs
in a multithreaded process, but libintl_setlocale() must not assume that. I
see a few ways libintl/gnulib might proceed:

1) exec() a helper program to run CFLocaleCopyCurrent(). Distributing that
executable alongside libintl and locating it at runtime is daunting.

2) Audit the CFLocaleCopyCurrent() code to see if it will, in practice, run
reliably in a fork of a multithreaded process. (That conclusion could
change without notice.) Use the setlocale_native_forked() technique.

3) Don't change libintl_setlocale(), but add a libintl_setlocale_nothread()
for single-threaded consumers to adopt. Each consumer will need to modify
code. libintl has a lean API; I expect adding this would be controversial.

Among those, I would probably adopt (2). We know much about the process
conditions in which pg_setlocale() will run, so placing the workaround in
PostgreSQL erases the problem of (2). I'm inclined to stick with placing the
workaround in PostgreSQL, but there are fair arguments on both sides.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2014-10-11 07:40:58 Re: Column Redaction
Previous Message Amit Kapila 2014-10-11 01:56:57 Re: Wait free LW_SHARED acquisition - v0.9