Re: "could not adopt C locale" failure at startup on Windows

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: "could not adopt C locale" failure at startup on Windows
Date: 2015-06-09 16:24:02
Message-ID: 9948.1433867042@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> writes:
> On 2015-06-09 11:20:06 -0400, Tom Lane wrote:
>> We've seen several reports of $SUBJECT lately. I have no idea what's
>> going on, but it occurred to me that it could be informative to tweak
>> init_locale() so that it reports which category failed to be set.
>> Any objections to squeezing that into today's releases?

> No objection, +1. Seems fairly low risk.

> The error seems odd. The only even remotely related change between 9.4.1
> and .2 seems to be ca325941. Could also be a build environment change.

Yeah, my first instinct was to blame ca325941 as well, but I don't think
any of that code executes during init_locale(). Also,
http://www.postgresql.org/message-id/20150326040321.2492.24716@wrigleys.postgresql.org
says it's been seen in 9.4.1. Of course, it might be premature to assume
that report had an identical cause to the later ones.

What I plan to do is this:

static void
init_locale(const char *categoryname, int category, const char *locale)
{
if (pg_perm_setlocale(category, locale) == NULL &&
pg_perm_setlocale(category, "C") == NULL)
elog(FATAL, "could not adopt either \"%s\" locale or C locale for %s", locale, categoryname);
}

with the obvious changes to the call sites to pass the string names of
the categories not just their numeric codes. (We could just log the
numbers, but it'd be much harder to interpret.) This might be overkill,
but when you don't know what you're looking for, every little bit helps ...

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-06-09 17:09:27 Draft release notes for 9.4.4 et al
Previous Message Tomas Vondra 2015-06-09 16:19:59 Re: The Future of Aggregation