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

Re: BUG #2246: Bad malloc interactions: ecpg, openssl

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Klosterman <andrew5(at)ece(dot)cmu(dot)edu>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2246: Bad malloc interactions: ecpg, openssl
Date: 2006-02-13 20:16:05
Message-ID: 4050.1139861765@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-patches
Andrew Klosterman <andrew5(at)ece(dot)cmu(dot)edu> writes:
> I threw in a pthread mutex around the code making the database connections
> for each of my threads.  The problem is still there ("corrupted
> double-linked list").

> Even tuning things down and instructing my code to only run a single
> pthread manifests the problem over an SSL connection.

Hmm.  Based on that, the problem is starting to smell more like a
garden-variety memory clobber, for instance malloc'ing a chunk smaller
than the data that's later stuffed into it.  It might be worth running
the program under something like ElectricFence, which will catch the
offender on-the-spot rather than only later when corruption of malloc's
private data structures is detected.

Looking back at your original message, I wonder if it could be the
combination of ecpg and SSL that triggers it?  I'd have thought that
libpq/SSL alone would be pretty well wrung out, but ecpg is not so
widely used.

BTW, you did say this was i386 right?  If it were a 64-bit architecture,
I'd be about ready to bet money on the wrong-malloc-size-calculation
theory.

> Tracking down exactly what's tickling the problem in this case could be
> tricky...

Yeah :-(.  If you aren't able to narrow it further by yourself, please
try to put together a self-contained test case.

			regards, tom lane

In response to

Responses

pgsql-bugs by date

Next:From: Andrew KlostermanDate: 2006-02-13 21:01:32
Subject: Re: BUG #2246: Bad malloc interactions: ecpg, openssl
Previous:From: Andrew KlostermanDate: 2006-02-13 19:35:49
Subject: Re: BUG #2246: Bad malloc interactions: ecpg, openssl

pgsql-patches by date

Next:From: Andrew KlostermanDate: 2006-02-13 21:01:32
Subject: Re: BUG #2246: Bad malloc interactions: ecpg, openssl
Previous:From: Bruce MomjianDate: 2006-02-13 19:59:43
Subject: Re: Free WAL caches on switching segments

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