pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Rowley <dgrowleyml@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: lauri.laanmets@eesti.ee
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: Memory leak on subquery as scalar operand
Date: Tue, 01 Nov 2022 00:52:16 -0400
Message-ID: <1084048.1667278336@sss.pgh.pa.us> (raw)
In-Reply-To: <CAApHDvqn55aqReCSAd9tpf06JV0sx=DYON+djSv1BqkJZ+NH_Q@mail.gmail.com>
References: <CAPH-tTxLf44s3CvUUtQpkDr1D8Hxqc2NGDzGXS1ODsfiJ6WSqA@mail.gmail.com>
	<CAApHDvrSbQkPUacnaonQzw1efFJM6HE5we-i9VVogBfEKGCCiA@mail.gmail.com>
	<1046179.1667263449@sss.pgh.pa.us>
	<CAApHDvpL=3-61Lsfd9P5vuf48sJgKYP1qUULDEoKcAsEJpZA7g@mail.gmail.com>
	<1073512.1667275802@sss.pgh.pa.us>
	<CAApHDvqn55aqReCSAd9tpf06JV0sx=DYON+djSv1BqkJZ+NH_Q@mail.gmail.com>

David Rowley <dgrowleyml@gmail.com> writes:
> The single subquery version also crashes for me, so perhaps it's just
> the amount of memory that's being used and when the OOM killer is
> triggering.
> It crashes even when I set jit_inline_above_cost and
> jit_optimize_above_cost above the query's cost.

Hmm, maybe we're not seeing the same thing?  For me, the behavior
seems similar to what the OP reported: there's a per-query leakage
but it's less than 100kB per query.  It'd take more than a handful
of repetitions to get to an OOM failure.  This is with LLVM 13.0.1
on RHEL 8.6.

Also, as far as I can see there is no leak with the single-subquery
version.  The process's reported VIRT consumption bounces around a
fair amount, but it doesn't go above 300MB, even after ~10min in
a tight plpgsql DO loop.  VIRT bounces around a lot with the
two-subquery version too, actually, but there does seem to be a
general uptrend there.  I did not have the patience to wait for
actual OOM; it looked like it'd take a good long while, tens
of minutes at least.

If the behavior varies across LLVM versions, as is now seeming
a bit likely, it might be their bug not ours.

			regards, tom lane





view thread (18+ messages)  latest in thread

Message-ID: <1084048.1667278336@sss.pgh.pa.us>
Permalink:  ../1084048.1667278336@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1084048.1667278336@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, dgrowleyml@gmail.com, andres@anarazel.de, lauri.laanmets@eesti.ee, pgsql-bugs@lists.postgresql.org
  Subject: Re: Memory leak on subquery as scalar operand
  In-Reply-To: <1084048.1667278336@sss.pgh.pa.us>

* 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