Re: libgcc double-free, backend won't die

From: Craig James <craig_james(at)emolecules(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, pgsql-performance(at)postgresql(dot)org
Subject: Re: libgcc double-free, backend won't die
Date: 2007-12-11 15:05:56
Message-ID: 475EA754.1090307@emolecules.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Alvaro Herrera wrote:
> Craig James wrote:
>> This is driving me crazy. I have some Postgres C function extensions
>> in a shared library. They've been working fine. I upgraded to Fedora
>> Core 6 and gcc4, and now every time psql(1) disconnects from the
>> server, the serverlog gets this message:
>>
>> *** glibc detected *** postgres: mydb mydb [local] idle: double free or corruption! (!prev): 0x08bfcde8
>
> Do you have any Perl or Python functions or stuff like that?

There is one Perl function, but it is never invoked during this test. I connect to Postgres, issue one "select myfunc()", and disconnect.

>> Postgres 8.1.4
>
> Please upgrade to 8.1.10 and try again. If it still fails we will be
> much more interested in tracking it down.

Good idea, but alas, no difference. I get the same "double free or corruption!" mesage. I compiled 8.1.10 from source and installed, then rebuilt all of my code from scratch and reinstalled the shared object. Same message as before.

Here is my guess -- and this is just a guess. My functions use a third-party library which, of necessity, uses malloc/free in the ordinary way. I suspect that there's a bug in the Postgres palloc() code that's walking over memory that regular malloc() allocates. The third-party library (OpenBabel) has been tested pretty thoroughly by me an others and has no memory corruption problems. All malloc's are freed properly. Does that seem like a possibility?

I can't figure out how to use ordinary tools like valgrind with a Postgres backend process to track this down.

Thanks,
Craig

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2007-12-11 15:07:13 Re: libgcc double-free, backend won't die
Previous Message Pallav Kalva 2007-12-11 15:02:26 Slow Query