Re: BUG #16925: ERROR: invalid DSA memory alloc request size 1073741824 CONTEXT: parallel worker

Thomas Munro <thomas.munro@gmail.com>

From: Thomas Munro <thomas.munro@gmail.com>
To: Andrei Lepikhov <a.lepikhov@postgrespro.ru>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>, "a.rybakina" <a.rybakina@postgrespro.ru>
Date: 2023-12-10T02:41:13Z
Lists: pgsql-bugs
On Wed, Dec 6, 2023 at 5:46 PM Andrei Lepikhov
<a.lepikhov@postgrespro.ru> wrote:
> On 18/3/2021 16:21, Thomas Munro wrote:
> > ===8<===
> > shared_buffers=2GB
> > fsync=off
> > max_wal_size=10GB
> > min_dynamic_shared_memory=2GB
> > ===8<===
> > create table bigger_than_it_looks as
> >    select generate_series(1, 256000000) as id;
> > alter table bigger_than_it_looks set (autovacuum_enabled = 'false');
> > alter table bigger_than_it_looks set (parallel_workers = 1);
> > analyze bigger_than_it_looks;
> > update pg_class set reltuples = 5000000 where relname = 'bigger_than_it_looks';
> > ===8<===
> > postgres=# set work_mem = '4.5GB';
> > SET
> > postgres=# explain analyze select count(*) from bigger_than_it_looks
> > t1 join bigger_than_it_looks t2 using (id);
> > ERROR:  invalid DSA memory alloc request size 1073741824
> > CONTEXT:  parallel worker
> > ===8<===
>
> This bug still annoyingly interrupts the queries of some clients. Maybe
> complete this work?

Ugh, sorry.  We had a report, a repro and a candidate patch a couple
of years ago, but I somehow completely forgot about it.  I have now
added a CF entry (#4689).



Commits

  1. Fix oversized memory allocation in Parallel Hash Join

  2. Limit Parallel Hash's bucket array to MaxAllocSize.