Thread: BUG #3640: PANIC: ERRORDATA_STACK_SIZE exceeded

BUG #3640: PANIC: ERRORDATA_STACK_SIZE exceeded

From
"Antonio Mari"
Date:
The following bug has been logged online:

Bug reference:      3640
Logged by:          Antonio Mari
Email address:      amari@at4.net
PostgreSQL version: 8.2.4
Operating system:   Linux xxxxxxxxx 2.6.17-gentoo-r7 #1 SMP Tue Aug 29
15:01:36 CEST 2006 i686 Intel(R) Xeon(TM) CPU 3.00GHz GenuineIntel GNU/Linux
Description:        PANIC:  ERRORDATA_STACK_SIZE exceeded
Details:

Hi,

First I'm going to put my configuration

root@xxxxxxxx::~# pg_config
BINDIR = /usr/bin
DOCDIR = /usr/share/doc/libpq-8.2.4/postgresql
INCLUDEDIR = /usr/include/postgresql/libpq-4
PKGINCLUDEDIR = /usr/include/postgresql/libpq-4
INCLUDEDIR-SERVER = /usr/include/postgresql/libpq-4/server
LIBDIR = /usr/lib
PKGLIBDIR = /usr/lib/postgresql
LOCALEDIR = /usr/share/locale
MANDIR = /usr/share/man
SHAREDIR = /usr/share/postgresql
SYSCONFDIR = /etc/postgresql
PGXS = /usr/lib/postgresql/pgxs/src/makefiles/pgxs.mk
CONFIGURE = '--prefix=/usr' '--includedir=/usr/include/postgresql/libpq-4'
'--sysconfdir=/etc/postgresql' '--mandir=/usr/share/man'
'--host=i686-pc-linux-gnu' '--with-docdir=/usr/share/doc/libpq-8.2.4'
'--libdir=/usr/lib' '--enable-depend' '--without-krb5' '--enable-nls'
'--with-pam' '--without-perl' '--disable-integer-datetimes'
'--without-python' '--with-readline' '--with-openssl' '--without-tcl'
'--disable-thread-safety' '--with-zlib' 'CFLAGS=-O2 -march=i686 -pipe'
'CPPFLAGS=' 'host_alias=i686-pc-linux-gnu'
CC = i686-pc-linux-gnu-gcc
CPPFLAGS = -D_GNU_SOURCE
CFLAGS = -O2 -march=i686 -pipe -Wall -Wmissing-prototypes -Wpointer-arith
-Winline -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing
CFLAGS_SL = -fpic
LDFLAGS = -Wl,-rpath,'/usr/lib'
LDFLAGS_SL =
LIBS = -lpgport -lpam -lssl -lcrypto -lz -lreadline -lcrypt -ldl -lm
VERSION = PostgreSQL 8.2.4


The control data infomation are:

root@xxxxxx::~# LC_ALL=C pg_controldata /home/pg/data/
pg_control version number:            822
Catalog version number:               200611241
Database system identifier:           5024274278997028863
Database cluster state:               in production
pg_control last modified:             Fri Sep 28 14:23:57 2007
Current log file ID:                  9
Next log file segment:                241
Latest checkpoint location:           9/F009E610
Prior checkpoint location:            9/F0079740
Latest checkpoint's REDO location:    9/F009E610
Latest checkpoint's UNDO location:    0/0
Latest checkpoint's TimeLineID:       1
Latest checkpoint's NextXID:          0/163813137
Latest checkpoint's NextOID:          75565308
Latest checkpoint's NextMultiXactId:  4
Latest checkpoint's NextMultiOffset:  7
Time of latest checkpoint:            Fri Sep 28 14:23:57 2007
Minimum recovery ending location:     0/0
Maximum data alignment:               4
Database block size:                  8192
Blocks per segment of large relation: 131072
WAL block size:                       8192
Bytes per WAL segment:                16777216
Maximum length of identifiers:        64
Maximum columns in an index:          32
Date/time type storage:               floating-point numbers
Maximum length of locale name:        128
LC_COLLATE:                           es_ES@euro
LC_CTYPE:                             es_ES@euro

As you see the initdb was initialized with es_ES@euro locale (LATIN9).

When connecting via psql to a database encoded in UTF8 and client_encoding
is LATIN9 (or LATIN1) and try a wrong query I've the PANIC error.

PANIC:  ERRORDATA_STACK_SIZE exceeded
server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
La conexión al servidor se ha perdido. Intentando reiniciar: falló.


The sequence is:

postgres@xxxxx::~$ createdb -E UTF8 testutf
CREATE DATABASE
postgres@xxxxx::~$ psql testutf
testutf=# SELECT kk;
ERROR:  no existe la columna «kk»
LINE 1: SELECT kk;
testutf=# SET client_encoding TO LATIN9;
testutf=# SELECT kk;
PANIC:  ERRORDATA_STACK_SIZE exceeded
server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!>

I've tried in 2 differents installations.

P.D. Sorry for my poor english.

Re: BUG #3640: PANIC: ERRORDATA_STACK_SIZE exceeded

From
Tom Lane
Date:
"Antonio Mari" <amari@at4.net> writes:
> LC_COLLATE:                           es_ES@euro
> LC_CTYPE:                             es_ES@euro

> As you see the initdb was initialized with es_ES@euro locale (LATIN9).

> When connecting via psql to a database encoded in UTF8 and client_encoding
> is LATIN9 (or LATIN1) and try a wrong query I've the PANIC error.

This is pilot error: you must have LC_COLLATE and LC_CTYPE compatible
with the database encoding.  The reason is that gettext looks to those
to determine what encoding to return localized error messages in, but
Postgres thinks they are in the database encoding, and only finds out
its mistake when it has to translate to another encoding.  Of course,
the error message reporting *that* also has to be translated ...

There are a lot of other things that don't work well when the locale
settings don't match the database encoding, so my advice is "don't do
that".

            regards, tom lane