Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 011392E012B for ; Tue, 11 Dec 2007 03:50:17 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 60199-07 for ; Tue, 11 Dec 2007 03:50:15 -0400 (AST) Received: from mail.emolecules.com (66-226-76-106.dedicated.abac.net [66.226.76.106]) by postgresql.org (Postfix) with ESMTP id 2DFD02E0124 for ; Tue, 11 Dec 2007 03:50:14 -0400 (AST) Received: (qmail 14959 invoked by uid 2020); 11 Dec 2007 00:05:49 -0800 Received: from wsip-68-224-174-233.sd.sd.cox.net (HELO lisa-james-computer.local) (68.224.174.233) by 192.168.0.4 with SMTP; 11 Dec 2007 00:05:49 -0800 Message-ID: <475E4133.5080009@emolecules.com> Date: Mon, 10 Dec 2007 23:50:11 -0800 From: Craig James User-Agent: Thunderbird 2.0.0.9 (Macintosh/20071031) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: libgcc double-free, backend won't die References: <7EB0D6C0-48E2-4155-8559-9113D3BD2785@ketema.net> <4728CF7B.7040306@gmail.com> <4728FB3E.3070709@shaw.ca> <472978BE.9@hagander.net> <4729B1E9.2080306@gmail.com> In-Reply-To: <4729B1E9.2080306@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200712/122 X-Sequence-Number: 27938 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 Thanks, Craig