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: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Cc: Karen Talarico <karen.talarico@swarm64.com>
Date: 2021-03-17T13:06:32Z
Lists: pgsql-bugs
On Sat, Mar 13, 2021 at 11:59 PM Thomas Munro <thomas.munro@gmail.com> wrote:
> > > 2021-03-12 19:45:37.352 CET [316243] ERROR: XX000: invalid DSA memory alloc
> > > request size 1073741824
After an off-list exchange with Karen and colleague who ran this with
the ERROR changed to a PANIC and examined the smoldering core, the
problem turns out to be a failure to keep the hashtable bucket array
<= MaxAllocSize in one code path. Although commit 86a2218e fixed
another version of that problem a while ago, it can still be
exceeded... by one byte... when we expand from one batch to many.
Will propose a fix.
dbuckets = Min(dbuckets,
MaxAllocSize / sizeof(dsa_pointer_atomic));
new_nbuckets = (int) dbuckets;
new_nbuckets = Max(new_nbuckets, 1024);
new_nbuckets = 1 << my_log2(new_nbuckets);
Commits
-
Fix oversized memory allocation in Parallel Hash Join
- 714a987bc133 16.2 landed
- 72d5b27763a8 12.18 landed
- 60de25c6efc8 13.14 landed
- 3bdaa8fc622f 14.11 landed
- 1a7c03e6fc75 15.6 landed
- 2a67b5a60ee6 17.0 landed
-
Limit Parallel Hash's bucket array to MaxAllocSize.
- 86a2218eb00e 11.0 cited