BUG #4196: Backend crash possible with psql

Lists: pgsql-bugs
From: "Daniel Mihowski" <dmigowski(at)ikoffice(dot)de>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4196: Backend crash possible with psql
Date: 2008-05-26 08:38:16
Message-ID: 200805260838.m4Q8cGMR072762@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 4196
Logged by: Daniel Mihowski
Email address: dmigowski(at)ikoffice(dot)de
PostgreSQL version: 8.3.1
Operating system: Windows XP
Description: Backend crash possible with psql
Details:

Hello, dear developers. When accessing the local postgresql server with
PGAdmin, it closes abnormally. This is my psql window:

#####################################################
Passwort fr Benutzer postgres:
Dies ist psql 8.3.1, das interaktive PostgreSQL-Terminal.

Geben Sie ein: \copyright fr Urheberrechtsinformationen
\h fr Hilfe ber SQL-Anweisungen
\? fr Hilfe ber interne Anweisungen
\g oder Semikolon, um eine Anfrage auszufhren
\q um zu beenden

Warnung: Konsolencodeseite (850) unterscheidet sich von der Windows-
Codeseite (1252). 8-Bit-Zeichen funktionieren mglicherweise
nicht
richtig. Einzelheiten finden Sie auf der psql-Handbuchseite unter
Notes for Windows users.

postgres=# \set
AUTOCOMMIT = 'on'
PROMPT1 = '%/%R%# '
PROMPT2 = '%/%R%# '
PROMPT3 = '>> '
VERBOSITY = 'default'
VERSION = 'PostgreSQL 8.3.1, compiled by Visual C++ build 1400'
DBNAME = 'postgres'
USER = 'postgres'
HOST = 'localhost'
PORT = '5434'
ENCODING = 'WIN1252'
postgres=# select blah;
#####################################################

After entering the last line, the postgres.exe process crashes. These are
the last lines of the logfile:

#####################################################
2008-05-26 10:29:20 CEST LOG: Anweisung: select blah;
2008-05-26 10:29:20 CEST FEHLER: Spalte blah existiert nicht bei
Zeichen 8
2008-05-26 10:29:20 CEST ANWEISUNG: select blah;
2008-05-26 10:29:20 CEST FEHLER: ungltige Byte-Sequenz fr Kodierung
UTF8: 0xbb
2008-05-26 10:29:20 CEST TIPP: Dieser Fehler kann auch auftreten, wenn die
Bytesequenz nicht mit der Kodierung bereinstimmt, die der Server erwartet,
welche durch client_encoding bestimmt wird.
2008-05-26 10:29:20 CEST ANWEISUNG: select blah;
2008-05-26 10:29:20 CEST FEHLER: ungltige Byte-Sequenz fr Kodierung
UTF8: 0xfc
2008-05-26 10:29:20 CEST TIPP: Dieser Fehler kann auch auftreten, wenn die
Bytesequenz nicht mit der Kodierung bereinstimmt, die der Server erwartet,
welche durch client_encoding bestimmt wird.
2008-05-26 10:29:20 CEST FEHLER: ungltige Byte-Sequenz fr Kodierung
UTF8: 0xfc
2008-05-26 10:29:20 CEST TIPP: Dieser Fehler kann auch auftreten, wenn die
Bytesequenz nicht mit der Kodierung bereinstimmt, die der Server erwartet,
welche durch client_encoding bestimmt wird.
2008-05-26 10:29:20 CEST FEHLER: ungltige Byte-Sequenz fr Kodierung
UTF8: 0xfc
2008-05-26 10:29:20 CEST TIPP: Dieser Fehler kann auch auftreten, wenn die
Bytesequenz nicht mit der Kodierung bereinstimmt, die der Server erwartet,
welche durch client_encoding bestimmt wird.
2008-05-26 10:29:20 CEST PANIK: ERRORDATA_STACK_SIZE exceeded

This application has requested the Runtime to terminate it in an unusual
way.
Please contact the application's support team for more information.
#####################################################

Since it looks like some encoding problem, the following information might
be heldful, too: My windows version is a German one, and the backend was
initialized with a german locale, sort order, etc.

With best regards,
Daniel Migowski


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Daniel Mihowski" <dmigowski(at)ikoffice(dot)de>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4196: Backend crash possible with psql
Date: 2008-05-26 15:16:23
Message-ID: 21590.1211814983@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

"Daniel Mihowski" <dmigowski(at)ikoffice(dot)de> writes:
> Description: Backend crash possible with psql

We've seen several similar reports, but the conditions that cause it are
not clear. Please show the values you are using for these database
parameters:
client_encoding
server_encoding
lc_collate
lc_ctype
lc_messages

regards, tom lane


From: Daniel Migowski <dmigowski(at)ikoffice(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4196: Backend crash possible with psql
Date: 2008-05-26 15:46:16
Message-ID: 483ADB48.4010001@ikoffice.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Hello Tom,

Tom Lane schrieb:
> Please show the values you are using for these database
> parameters:
> client_encoding
> server_encoding
> lc_collate
> lc_ctype
> lc_messages
client_encoding: WIN1252
server_encoding: UTF8
lc_collate: German_Germany.1252
lc_ctype: German_Germany.1252
lc_messages: German_Germany

Please let me know if you need more info. For me it looks like the
server reads the localized error messages in system encoding (win1252),
but assumes they are in utf8 in the server.

With best regards,
Daniel Migowski


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Daniel Migowski <dmigowski(at)ikoffice(dot)de>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4196: Backend crash possible with psql
Date: 2008-05-26 15:58:29
Message-ID: 22106.1211817509@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Daniel Migowski <dmigowski(at)ikoffice(dot)de> writes:
> client_encoding: WIN1252
> server_encoding: UTF8
> lc_collate: German_Germany.1252
> lc_ctype: German_Germany.1252
> lc_messages: German_Germany

Thanks for the info --- we have been unable to get these values from
previous complainants, so this is a real help.

> Please let me know if you need more info. For me it looks like the
> server reads the localized error messages in system encoding (win1252),
> but assumes they are in utf8 in the server.

Yeah, that's what I think too. Specifically, we expect the gettext
package to deliver translated error messages in the server_encoding,
but it seems that's not what we're getting on Windows. Without having
dug into the gettext code, I wonder whether it is looking at lc_ctype
and thinking it should return WIN1252 strings.

Another interesting question is how initdb allowed you to select the
above combination of settings. 8.3 is supposed to enforce that
server_encoding is the same as the encoding implied by lc_ctype,
which is evidently not the case here. I recall we were tinkering with
that code before 8.3 release, but I guess it's still not right :-(

regards, tom lane


From: Daniel Migowski <dmigowski(at)ikoffice(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4196: Backend crash possible with psql
Date: 2008-05-26 16:08:01
Message-ID: 483AE061.4070606@ikoffice.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Hello, Tom,

Tom Lane schrieb:
>
> Yeah, that's what I think too. Specifically, we expect the gettext
> package to deliver translated error messages in the server_encoding,
> but it seems that's not what we're getting on Windows. Without having
> dug into the gettext code, I wonder whether it is looking at lc_ctype
> and thinking it should return WIN1252 strings.
>
> Another interesting question is how initdb allowed you to select the
> above combination of settings. 8.3 is supposed to enforce that
> server_encoding is the same as the encoding implied by lc_ctype,
> which is evidently not the case here.
Why shouldn't this be possible? It must be possible to store the data in
UTF-8, and of course, to use this a the server encoding. The characters
used should be collated by German and use the german upper/lower
conventions. Looks perfectly sane to me.
> I recall we were tinkering with
> that code before 8.3 release, but I guess it's still not right :-(
>
> regards, tom lane
>
With best regards,
Daniel Migowski


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Daniel Migowski <dmigowski(at)ikoffice(dot)de>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4196: Backend crash possible with psql
Date: 2008-05-26 16:10:41
Message-ID: 22282.1211818241@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Oh, one other thing: if the theory about gettext delivering the "wrong"
encoding is correct, then the error messages going into the postmaster
log should be in WIN1252 encoding, rather than UTF8 which is the
intended behavior when server_encoding is UTF8. The log snippet in your
bug report was UTF8, but that might have gotten converted somewhere
along the line. Can you confirm which encoding is actually present in
the log file?

regards, tom lane


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Daniel Mihowski" <dmigowski(at)ikoffice(dot)de>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4196: Backend crash possible with psql
Date: 2008-05-27 14:19:35
Message-ID: 27201.1211897975@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

"Daniel Mihowski" <dmigowski(at)ikoffice(dot)de> writes:
> Bug reference: 4196
> Logged by: Daniel Mihowski
> Email address: dmigowski(at)ikoffice(dot)de
> PostgreSQL version: 8.3.1
> Operating system: Windows XP
> Description: Backend crash possible with psql
> Details:

> Hello, dear developers. When accessing the local postgresql server with
> PGAdmin, it closes abnormally. This is my psql window:

This is now believed fixed, and will be in 8.3.2:
http://archives.postgresql.org/pgsql-committers/2008-05/msg00349.php

Thanks for your help in isolating the cause.

regards, tom lane