Skip site navigation (1) Skip section navigation (2)

libgcc double-free, backend won't die

From: Craig James <craig_james(at)emolecules(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: libgcc double-free, backend won't die
Date: 2007-12-11 07:50:11
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
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

and the backend process won't die.  Every single connection that executes one of my functions leaves an idle process, like this:

  $ ps -ef | grep postgres
  postgres 12938 12920  0  23:24 ?    00:00:00 postgres: mydb mydb [local] idle

This error only happens on disconnect.  As long as I keep the connection open, I can 

Worse, these zombie Postgres processes won't die, which means I can't shut down and restart Postgres unless I "kill -9" all of them, and I can't use this at all because I get zillions of these dead processes.

I've used valgrind on a test application that runs all of my functions outside of the Postgres environment, and not a single problem shows up even after hours of processing.  I tried setting MALLOC_CHECK_ to various values, so that I could trap the abort() call using gdb, but once MALLOC_CHECK_ is set, the double-free error never occurs.  (But malloc slows down too much this way.)

I even read through the documentation for C functions again, and carefully examined my code.  Nothing is amiss, some of the functions are quite simple yet still exhibit this problem.

Anyone seen this before?  It's driving me nuts.

  Postgres 8.1.4
  Linux kernel 2.6.22
  gcc 4.1.1


In response to


pgsql-performance by date

Next:From: Manolo _Date: 2007-12-11 11:06:52
Subject: Benchmarking PG
Previous:From: Greg SmithDate: 2007-12-11 00:36:32
Subject: Re: database tuning

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group