pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michal Novotny <michal.novotny@greycortex.com>
To: Craig Ringer <craig@2ndquadrant.com>
To: Andres Freund <andres@anarazel.de>
Cc: Merlin Moncure <mmoncure@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs <pgsql-bugs@postgresql.org>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: [BUGS] Segmentation fault in libpq
Date: Mon, 3 Jul 2017 09:36:15 +0200
Message-ID: <d3bacd6d-296e-8e7e-6c75-5a3808701f4d@greycortex.com> (raw)
In-Reply-To: <CAMsr+YF9jdu4TpX9F9WcwYqWSvp+4t20nwJNkOgqMfVVQ7TdsQ@mail.gmail.com>
References: <b58db7a6-a80a-8db2-9ef2-5ae0fd3ca545@greycortex.com>
	<CAHyXU0zPsUz5qWDPpzYZ3LYOgDRdiB45RJ91pi32NvcN9xPEWQ@mail.gmail.com>
	<2a0f743f-4d96-30b1-8b5d-86541e8bcb34@greycortex.com>
	<CAHyXU0x29T3QWFDwUT6jvVhdp6dhoJC2B20XR52AR=54Em=Vpw@mail.gmail.com>
	<14445.1498745576@sss.pgh.pa.us>
	<CAHyXU0yjj49MzD5Sei3g4ihL_gzVDxFhJt2Qs9NfgYkaJEw4hA@mail.gmail.com>
	<CACSGxCNfmqBXKoK6MqZvofsrcX0ZpTc-Cx+mCZWxhHL=RzZabw@mail.gmail.com>
	<20170702191222.uk4hokc2iumzeenh@alap3.anarazel.de>
	<CAMsr+YF9jdu4TpX9F9WcwYqWSvp+4t20nwJNkOgqMfVVQ7TdsQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>



On 07/03/2017 04:58 AM, Craig Ringer wrote:
> On 3 July 2017 at 03:12, Andres Freund <andres@anarazel.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.novotny@greycortex.com

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



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (11+ messages)

Message-ID: <d3bacd6d-296e-8e7e-6c75-5a3808701f4d@greycortex.com>
Permalink:  ../d3bacd6d-296e-8e7e-6c75-5a3808701f4d@greycortex.com/
Also on:    postgresql.org/message-id/d3bacd6d-296e-8e7e-6c75-5a3808701f4d@greycortex.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: michal.novotny@greycortex.com, craig@2ndquadrant.com, andres@anarazel.de, mmoncure@gmail.com, tgl@sss.pgh.pa.us, pgsql-hackers@postgresql.org
  Subject: Re: [BUGS] Segmentation fault in libpq
  In-Reply-To: <d3bacd6d-296e-8e7e-6c75-5a3808701f4d@greycortex.com>
  References: <b58db7a6-a80a-8db2-9ef2-5ae0fd3ca545@greycortex.com> <CAHyXU0zPsUz5qWDPpzYZ3LYOgDRdiB45RJ91pi32NvcN9xPEWQ@mail.gmail.com> <2a0f743f-4d96-30b1-8b5d-86541e8bcb34@greycortex.com> <CAHyXU0x29T3QWFDwUT6jvVhdp6dhoJC2B20XR52AR=54Em=Vpw@mail.gmail.com> <14445.1498745576@sss.pgh.pa.us> <CAHyXU0yjj49MzD5Sei3g4ihL_gzVDxFhJt2Qs9NfgYkaJEw4hA@mail.gmail.com> <CACSGxCNfmqBXKoK6MqZvofsrcX0ZpTc-Cx+mCZWxhHL=RzZabw@mail.gmail.com> <20170702191222.uk4hokc2iumzeenh@alap3.anarazel.de> <CAMsr+YF9jdu4TpX9F9WcwYqWSvp+4t20nwJNkOgqMfVVQ7TdsQ@mail.gmail.com> <d3bacd6d-296e-8e7e-6c75-5a3808701f4d@greycortex.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox