Re: PQmakeEmptyPQresult makes my application dumps core?

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: <wooh(at)wooh(dot)hu>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: PQmakeEmptyPQresult makes my application dumps core?
Date: 2007-10-10 11:51:20
Message-ID: 87zlyr9ohz.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Adam PAPAI" <wooh(at)wooh(dot)hu> writes:

> PostgreSQL version: (PostgreSQL) 7.4.7

Incidentally there have been 11 bug-fix releases to 7.4 since this one.
Several of those cause crashes or data corruption and you would be
well-advised to install 7.4.18 asap. Normally you don't need a dump/restore
but there were a couple bug-fix releases in that branch which might require
one depending on what locale you're using.

But that's not what's causing your problem I don't think:

> Usually our program dumps core several times a day, but the reason is unknown.
> All I know from the core file is the lines below.
>
> during PQexec(db->conn, query) it dumps core.
>
> Should it happen due to a connection problem between the pgsql server and our
> program? What could be the resolution to avoid the coredumps?
>
> (gdb) up
> #1 0xb7df4cff in malloc () from /lib/tls/libc.so.6
> (gdb) up
> #2 0xb7eed753 in PQmakeEmptyPGresult () from /usr/lib/libpq.so.3

This core dump is from the client, not the database server. That it's coming
from malloc makes me think it's likely you've done something wrong with your
memory allocations previously. Double-freeing a pointer, freeing a pointer
which didn't come from malloc, writing past the end or beginning of the
allocated memory, etc. Any bug like this can cause random core dumps in malloc
or free later.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Evgeni 2007-10-10 13:01:52 BUG #3665: INSERT is not allowed in a non-volatile function
Previous Message Tom Lane 2007-10-10 11:49:02 Re: PQmakeEmptyPQresult makes my application dumps core?