pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: ropeladder@gmail.com, PostgreSQL mailing lists <pgsql-bugs@postgresql.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Subject: Re: BUG #14843: CREATE TABLE churns through all memory, crashes db
Date: Fri, 6 Oct 2017 11:01:43 -0700
Message-ID: <20171006180143.rq3idmtijbeahjyj@alap3.anarazel.de> (raw)
In-Reply-To: <CAB7nPqRjCoFMFVb7RcG5ztxzmobALij0O21m3-p8qNbxw37ouA@mail.gmail.com>
References: <20171005230321.28561.15927@wrigleys.postgresql.org>
	<20171005231611.5tfuwmeihma6mtu5@alap3.anarazel.de>
	<CAB7nPqSV0XkeERHWGfBFQ_-R3eZd1Rmr7BJVdwDkBp=PTzmzGw@mail.gmail.com>
	<CAB7nPqRjCoFMFVb7RcG5ztxzmobALij0O21m3-p8qNbxw37ouA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

On 2017-10-06 12:57:59 +0900, Michael Paquier wrote:
> On Fri, Oct 6, 2017 at 10:00 AM, Michael Paquier
> <michael.paquier@gmail.com> wrote:
> > This is suspicious:
> >       ExecutorState: 62906368 total in 17 blocks; 13736 free (35
> > chunks); 62892632 used
> 
> The introduction of the ProjectSet node has caused the regressionin
> the executor visibly. A bisect run is showing me this commit as the
> culprit
> commit 69f4b9c85f168ae006929eec44fc44d569e846b9
> Author: Andres Freund <andres@anarazel.de>
> Date:   Wed Jan 18 12:46:50 2017 -0800
> Move targetlist SRF handling from expression evaluation to new executor node.
> 
> I was expecting a leak of some kind first, but valgrind does not
> complain when executing the query eating all the memory. Before this
> commit the memory usage remains low and stable, less than 1% in my
> environments.

It's "just" a MemoryContextSwitchTo() that some idiot^WI forgot and
reviews didn't spot. The ResetExprContext() in ExecProjectSet() is
correctly placed afaict, it's just that we leak (query scope) a lot into
the surrounding memory context.  A MemoryContextSwitchTo() at the top &
bottom of ExecProjectSet() fixes the issue for me.

Greetings,

Andres Freund


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



view thread (10+ messages)  latest in thread

Message-ID: <20171006180143.rq3idmtijbeahjyj@alap3.anarazel.de>
Permalink:  ../20171006180143.rq3idmtijbeahjyj@alap3.anarazel.de/
Also on:    postgresql.org/message-id/20171006180143.rq3idmtijbeahjyj@alap3.anarazel.de

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: andres@anarazel.de, michael.paquier@gmail.com, tgl@sss.pgh.pa.us
  Subject: Re: BUG #14843: CREATE TABLE churns through all memory, crashes db
  In-Reply-To: <20171006180143.rq3idmtijbeahjyj@alap3.anarazel.de>

* 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