Re: ERROR: too many dynamic shared memory segment

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Ben Kanouse <kanobt61(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: ERROR: too many dynamic shared memory segment
Date: 2020-11-17 21:55:18
Message-ID: CA+hUKGKJznw57gQT_HXd-Ko-jAD5J4kPt_K51RYGdEdiVwo0LA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Nov 18, 2020 at 4:21 AM Ben Kanouse <kanobt61(at)gmail(dot)com> wrote:
> My database is experiencing a 'ERROR: too many dynamic shared memory
> segment' error from time to time. It seems to happen most when traffic
> is high, and it happens with semi-simple select statements that run a
> parallel query plan with a parallel bitmap heap scan. It is currently
> on version 12.4.
>
> Here is an example query: https://explain.depesz.com/s/aatA

Hmm, not sure how this plan could cause the problem, even if running
many copies of it. In the past, this problem has been reported from
single queries that had a very high number of separate Gather nodes,
or very very large parallel hash joins, or, once you've hit the error
a few times those ways, also due to an ancient DSM leak that was fixed
in 93745f1e (fix present in 12.4).

> I noticed in version 13.1 there is a commit that changes the
> multiplier from 2 to 5:
> https://github.com/postgres/postgres/commit/d061ea21fc1cc1c657bb5c742f5c4a1564e82ee2
>
> maxitems = 64 + 5 * MaxBackends
>
> Should this commit be back-ported to earlier versions of postgres to
> prevent this error in other versions?

Yeah, that seems like a good idea anyway. I will do that tomorrow,
barring objections.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2020-11-17 22:00:11 Re: ERROR: too many dynamic shared memory segment
Previous Message Justin Pryzby 2020-11-17 21:53:21 Re: proposal: possibility to read dumped table's name from file