Re: BUG #2246: Bad malloc interactions: ecpg, openssl - Mailing list pgsql-bugs

From Andrew Klosterman
Subject Re: BUG #2246: Bad malloc interactions: ecpg, openssl
Date
Msg-id Pine.LNX.4.53L-ECE.CMU.EDU.0602131419370.18395@blossom.pdl.cmu.edu
Whole thread Raw
In response to Re: BUG #2246: Bad malloc interactions: ecpg, openssl  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Wed, 8 Feb 2006, Tom Lane wrote:

> "Andy Klosterman" <andrew5@ece.cmu.edu> writes:
> > SPECULATION: Another possibility is that I misunderstand some aspect of
> > multi-threaded interactions with Postgres (I open uniquely named connections
> > to the DB for each thread of my test program).  Maybe I need to have a
> > "lock" around the code that makes DB connections and make sure that only one
> > happens at a time (might be better handled within Postgres/SSL if that is
> > the case).
>
> There could be some re-entrancy problem in the SSL connection startup
> code --- if you add such a lock, does it get more reliable?  Also, did
> you remember to build PG with --enable-thread-safety ?
>
>             regards, tom lane

(I'm back after a bit of an illness.  Much better now!)

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.  Everything is just
fine without SSL.  Other code I've written works just fine with (and
without) threads connecting to the database with (and without) SSL.
Tracking down exactly what's tickling the problem in this case could be
tricky...

I'm using the pre-built debian testing packages, not self-compiled code,
for my postgres installation.  From the information I can gather from the
debian build logs (http://buildd.debian.org/build.php), everything was
configured and built with threads enabled.

--Andrew J. Klosterman
andrew5@ece.cmu.edu

pgsql-bugs by date:

Previous
From: Andrew Klosterman
Date:
Subject: Re: BUG #2246: Bad malloc interactions: ecpg, openssl
Next
From: Stephen Frost
Date:
Subject: Re: BUG #2246: Bad malloc interactions: ecpg, openssl