Re: invalid memory alloc request size from pg_stat_activity?

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Euler Taveira <euler@timbira.com.br>, James Tomson <james@pushd.com>, pgsql-bugs@lists.postgresql.org, Eric Jensen <ej@pushd.com>
Date: 2019-05-07T15:14:27Z
Lists: pgsql-bugs
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> Hmm, but 102400 is only 100kB, nowhere near the 1GB-1 limit, so there's
> something odd going on there.

I can reproduce the described behavior by also setting max_connections
to something around 16K.

Now, it seems pretty silly to me to be burning in excess of 1GB of shmem
just for the current-query strings, and then that much again in every
backend that reads pg_stat_activity.  But should we be telling people they
can't do it?  I'm working on a patch to use MemoryContextAllocHuge for
the "localactivity" buffer in pgstat_read_current_status.  It might seem
dumb now, but perhaps in ten years it'll be common.

			regards, tom lane



Commits

  1. Avoid "invalid memory alloc request size" while reading pg_stat_activity.