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

From: Andrew Klosterman <andrew5(at)ece(dot)cmu(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2246: Bad malloc interactions: ecpg, openssl
Date: 2006-02-13 19:35:49
Message-ID: Pine.LNX.4.53L-ECE.CMU.EDU.0602131419370.18395@blossom.pdl.cmu.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-patches

On Wed, 8 Feb 2006, Tom Lane wrote:

> "Andy Klosterman" <andrew5(at)ece(dot)cmu(dot)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(at)ece(dot)cmu(dot)edu

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2006-02-13 20:16:05 Re: BUG #2246: Bad malloc interactions: ecpg, openssl
Previous Message James Gray 2006-02-13 17:52:18 BUG #2258: debug_print_plan doesn't work for cursors

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2006-02-13 19:59:43 Re: Free WAL caches on switching segments
Previous Message Tom Lane 2006-02-13 19:14:33 Re: Using stats_command_string for xact statistics