Thread: BUG #1897: dmalloc memory error on PQconnectdb

BUG #1897: dmalloc memory error on PQconnectdb

From
"Wade Hampton"
Date:
The following bug has been logged online:

Bug reference:      1897
Logged by:          Wade Hampton
Email address:      wade.hampton@nsc1.net
PostgreSQL version: 8.0.3-1
Operating system:   Fedora Core 4
Description:        dmalloc memory error on PQconnectdb
Details:

I have a multithreaded application using Postgresql and am testing for
memory leaks.  I compiled and linked with dmallocth.  My PGconnect() is now
causing a dmalloc abort.  The error appears to be a calloc of 0 elements of
40 bytes in libkrb5, called from libpq.

The connection is to:  hostaddr = 127.0.0.1 dbname = mydb

The same code with dmalloc works fine with Fedora Core 2.0, Postgresql
7.4.7-3.

There was a report of a similar problem in earlier versions:

http://www.mail-archive.com/pgsql-bugs@postgresql.org/msg08081.html

Re: BUG #1897: dmalloc memory error on PQconnectdb

From
Tom Lane
Date:
"Wade Hampton" <wade.hampton@nsc1.net> writes:
> I have a multithreaded application using Postgresql and am testing for
> memory leaks.  I compiled and linked with dmallocth.  My PGconnect() is now
> causing a dmalloc abort.  The error appears to be a calloc of 0 elements of
> 40 bytes in libkrb5, called from libpq.

(1) Why is that a bug?  calloc of 0 elements is explicitly allowed by
the Single Unix Spec:
http://www.opengroup.org/onlinepubs/007908799/xsh/calloc.html

(2) If you do think it's a bug, why are you complaining to us rather
than to the Kerberos people?

            regards, tom lane

problem start database

From
"Ing. Jhon Carrillo - Caracas, Venezuela"
Date:
hi,

i have a problem when i run the initdb file, do you know anything?

bash-2.05b$ /usr/lib/postgresql/bin/initdb -D /var/lib/pgsql/data
The files belonging to this database system will be owned by user
"postgres".
This user must also own the server process.

The database cluster will be initialized with locale C.

fixing permissions on existing directory /var/lib/pgsql/data ... ok
creating directory /var/lib/pgsql/data/global ... ok
creating directory /var/lib/pgsql/data/pg_xlog ... ok
creating directory /var/lib/pgsql/data/pg_xlog/archive_status ... ok
creating directory /var/lib/pgsql/data/pg_clog ... ok
creating directory /var/lib/pgsql/data/pg_subtrans ... ok
creating directory /var/lib/pgsql/data/base ... ok
creating directory /var/lib/pgsql/data/base/1 ... ok
creating directory /var/lib/pgsql/data/pg_tblspc ... ok
selecting default max_connections ... 10
selecting default shared_buffers ... 50
creating configuration files ... ok
creating template1 database in /var/lib/pgsql/data/base/1 ... FATAL:  XX000:
failed to initialize lc_messages to ""
LOCATION:  InitializeGUCOptions, guc.c:2389
child process exited with exit code 1
initdb: removing contents of data directory "/var/lib/pgsql/data"


thanks.

Re: problem start database

From
Devrim GUNDUZ
Date:
Hi,

On Tue, 20 Sep 2005, Ing. Jhon Carrillo - Caracas, Venezuela wrote:

> i have a problem when i run the initdb file, do you know anything?
>
> bash-2.05b$ /usr/lib/postgresql/bin/initdb -D /var/lib/pgsql/data
> The files belonging to this database system will be owned by user
> "postgres".
> This user must also own the server process.
>
> The database cluster will be initialized with locale C.

<snipped>

> creating directory /var/lib/pgsql/data/pg_tblspc ... ok
> selecting default max_connections ... 10
> selecting default shared_buffers ... 50
> creating configuration files ... ok
> creating template1 database in /var/lib/pgsql/data/base/1 ... FATAL:  XX000:
> failed to initialize lc_messages to ""
> LOCATION:  InitializeGUCOptions, guc.c:2389

This reminded me a bug that was fixed in 7.4.2. Are you using 7.4 or
7.4.1?

Regards,
--
Devrim GUNDUZ
Kivi Biliþim Teknolojileri - http://www.kivi.com.tr
devrim~gunduz.org, devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
                       http://www.gunduz.org

Re: problem start database

From
Tom Lane
Date:
"Ing. Jhon Carrillo - Caracas, Venezuela" <jdigital@cantv.net> writes:
> creating template1 database in /var/lib/pgsql/data/base/1 ... FATAL:  XX000:
> failed to initialize lc_messages to ""

What PG version is this exactly, what platform are you running it on,
and what locale environment are you running initdb in?  (For the last
question, show the output of "locale", or if you don't have that
program then "env | grep ^L".)

            regards, tom lane