From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: Roman Cervenak <roman@cervenak.info>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: Memory leak (possibly connected to postgis) leading to server crash
Date: Fri, 13 Dec 2019 14:20:36 +0100
Message-ID: <20191213132036.3m27dlquaxoorkja@development> (raw)
In-Reply-To: <CAGjExY2xQa8hxEYBTDDv6Y66V2=D0HEDsmLt42ZVupC3BxsLsQ@mail.gmail.com>
References: <CAGjExY1C40d=cqbf6nfeNDCLWk57MhFu3mgR0+KRPb8+_uW_KA@mail.gmail.com>
<20191206110154.v7yshqsn32zyxx4q@development>
<CAGjExY0sFbx+JytMkY-h8=NWqD_f0DOwB8QXrQ4SqJ+BttoX6g@mail.gmail.com>
<20191206124119.qe2xaffcbkcbmve3@development>
<CAGjExY0Kb0-h3MqWbiYry3e40nKbYyOW3-=BO7iKLJpo8R66aw@mail.gmail.com>
<18069.1576082949@sss.pgh.pa.us>
<CAGjExY2xQa8hxEYBTDDv6Y66V2=D0HEDsmLt42ZVupC3BxsLsQ@mail.gmail.com>
On Fri, Dec 13, 2019 at 11:51:55AM +0100, Roman Cervenak wrote:
>With "postgresql-12-dbgsym" installed,
>call MemoryContextStats(TopMemoryContext) succeeded on postgres backend
>process with high memory consumption.
>I cut it from server logs, see attached file (I have redacted queries and
>table structures, I left SELECT parts where is visible that geometric
>operations are involved).
>
The way I read the context stats, the memory leak has to be somewhere in
a library calling malloc directly, or something like that. Because per
the log, the PostgreSQL memory contexts are a whopping 5MB in total:
Grand total: 5683464 bytes in 1082 blocks; 2027536 free (362 chunks); 3655928
So this is likely a memory leak either somewhere in PostGIS (I see ~200
malloc calls in the current source code) or maybe in one of the
libraries it's using.
I think at this point we need to get more information about the queries
and data, or even better a reproducer. Or try running the queries under
valgrind, which does have a memory leak detector.
regards
--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
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: tomas.vondra@2ndquadrant.com, roman@cervenak.info, tgl@sss.pgh.pa.us
Subject: Re: Memory leak (possibly connected to postgis) leading to server crash
In-Reply-To: <20191213132036.3m27dlquaxoorkja@development>
References: <CAGjExY1C40d=cqbf6nfeNDCLWk57MhFu3mgR0+KRPb8+_uW_KA@mail.gmail.com> <20191206110154.v7yshqsn32zyxx4q@development> <CAGjExY0sFbx+JytMkY-h8=NWqD_f0DOwB8QXrQ4SqJ+BttoX6g@mail.gmail.com> <20191206124119.qe2xaffcbkcbmve3@development> <CAGjExY0Kb0-h3MqWbiYry3e40nKbYyOW3-=BO7iKLJpo8R66aw@mail.gmail.com> <18069.1576082949@sss.pgh.pa.us> <CAGjExY2xQa8hxEYBTDDv6Y66V2=D0HEDsmLt42ZVupC3BxsLsQ@mail.gmail.com> <20191213132036.3m27dlquaxoorkja@development>
* 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