Re: unconstrained memory growth in long running procedure stored procedure after upgrading 11-12 - Mailing list pgsql-hackers

From Justin Pryzby
Subject Re: unconstrained memory growth in long running procedure stored procedure after upgrading 11-12
Date
Msg-id 20210331040751.GU4431@telsasoft.com
Whole thread Raw
In response to unconstrained memory growth in long running procedure stored procedure after upgrading 11-12  (Merlin Moncure <mmoncure@gmail.com>)
List 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



pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: What to call an executor node which lazily caches tuples in a hash table?
Next
From: Amit Kapila
Date:
Subject: Re: extra semicolon in postgres_fdw test cases