Re: [BUGS] Segmentation fault in libpq

From: Michal Novotny <michal(dot)novotny(at)greycortex(dot)com>
To: Craig Ringer <craig(at)2ndquadrant(dot)com>, Andres Freund <andres(at)anarazel(dot)de>
Cc: Merlin Moncure <mmoncure(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [BUGS] Segmentation fault in libpq
Date: 2017-07-03 07:36:15
Message-ID: d3bacd6d-296e-8e7e-6c75-5a3808701f4d@greycortex.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On 07/03/2017 04:58 AM, Craig Ringer wrote:
> On 3 July 2017 at 03:12, Andres Freund <andres(at)anarazel(dot)de> wrote:
>> Hi,
>>
>> On 2017-07-02 20:58:52 +0200, Michal Novotný wrote:
>>> thank you all for your advice. I've been investigating this a little more
>>> and finally it turned out it's not a bug in libpq although I got confused
>>> by going deep as several libpq functions. The bug was really on our side
>>> after trying to use connection pointer after calling PQfinish(). The code
>>> is pretty complex so it took some time to investigate however I would like
>>> to apologize for "blaming" libpq instead of our code.
>> Usually using a tool like valgrind is quite helpful to find issues like
>> that, because it'll show you the call-stack accessing the memory and
>> *also* the call-stack that lead to the memory being freed.
> Yep, huge help.
>
> BTW, on Windows, the free tool DrMemory (now 64-bit too, yay) or
> commercial Purify work great.

Well, good to know about Windows stuff however we use Linux so that's
not a big deal. Unfortunately it's easy to miss something in valgrind if
you have once multi-threaded library linked to libpq and this
multi-threaded library is used in conjunction with another libraries
sharing some of the data among them.

Thanks once again,
Michal

--
Michal Novotny
System Development Lead
michal(dot)novotny(at)greycortex(dot)com

GREYCORTEX s.r.o.
Purkynova 127, 61200 Brno
Czech Republic
www.greycortex.com

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message yuki 2017-07-03 08:55:24 BUG #14728: Missing "pg_config.h" in the "postgresql96-devel" package
Previous Message Michal Novotny 2017-07-03 07:33:31 Re: [BUGS] Segmentation fault in libpq

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2017-07-03 07:52:13 Re: Macros bundling RELKIND_* conditions
Previous Message Michal Novotny 2017-07-03 07:33:31 Re: [BUGS] Segmentation fault in libpq