Re: unconstrained memory growth in long running procedure stored procedure after upgrading 11-12

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: unconstrained memory growth in long running procedure stored procedure after upgrading 11-12
Date: 2021-03-31 04:07:51
Message-ID: 20210331040751.GU4431@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 30, 2021 at 04:17:03PM -0500, Merlin Moncure wrote:
> Instructions:
> 1. run the attached script in psql, pgtask_test.sql. It will create a
> database, initialize it, and run the main procedure. dblink must be
> available
> 2. in another window, run SELECT CreateTaskChain('test', 'DEV');

For your reproducer, I needed to:
1.1) comment this:
|INSERT INTO Task SELECT
| -- 'test',
1.2) then run: CALL MAIN();

Anyway I reproduced this without an extension this time:

CREATE OR REPLACE FUNCTION cfn() RETURNS void LANGUAGE PLPGSQL AS $$ declare a record; begin FOR a IN SELECT generate_series(1,99) LOOP PERFORM format('select 1'); END LOOP; END $$;
$ yes 'SET jit_above_cost=0; SET jit_inline_above_cost=0; SET jit=on; SET client_min_messages=debug; SET log_executor_stats=on; SELECT cfn();' |head -11 |psql 2>&1 |grep 'max resident'
! 33708 kB max resident size
! 35956 kB max resident size
! 37800 kB max resident size
! 40300 kB max resident size
! 41928 kB max resident size
! 43928 kB max resident size
! 48496 kB max resident size
! 48964 kB max resident size
! 50460 kB max resident size
! 52272 kB max resident size
! 53740 kB max resident size

There's also a relatively microscopic leak even if inline is off. It may be
that this is what I reproduced last time - I couldn't see how a few hundred kB
leak was causing a our process to be GB sized. It may or may not be a separate
issue, though.

--
Justin

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-03-31 04:17:15 Re: extra semicolon in postgres_fdw test cases
Previous Message David Rowley 2021-03-31 04:06:40 Re: What to call an executor node which lazily caches tuples in a hash table?