pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
ERROR: could not attach to dynamic shared area
6+ messages / 5 participants
[nested] [flat]

* ERROR: could not attach to dynamic shared area
@ 2021-03-24 08:01  Albrecht Dreß <albrecht.dress@netcologne.de>
  0 siblings, 1 reply; 6+ messages in thread

From: Albrecht Dreß @ 2021-03-24 08:01 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

Hi all,

in the logs of my database server, I found the following message:

> ERROR: could not attach to dynamic shared area
> LOG: background worker "parallel worker" (PID 51151) exited with exit code 1

What is the meaning of the error?  The box is running Debian Buster, using the official PostgreSQL 13.2 deb's.  The machine has 384 GByte RAM, which, according to the Nagios logs, was /not/ filled completely (~1/3 free) when the message occurred, so I don't think its a system OOM condition.  I did not observe any other effects (like data loss or similar).

Any idea what might trigger such an error condition?  Should I adjust the config to avoid them?  How?

Thanks in advance,
Albrecht.

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: ERROR: could not attach to dynamic shared area
@ 2021-03-24 16:09  Laurenz Albe <laurenz.albe@cybertec.at>
  parent: Albrecht Dreß <albrecht.dress@netcologne.de>
  0 siblings, 2 replies; 6+ messages in thread

From: Laurenz Albe @ 2021-03-24 16:09 UTC (permalink / raw)
  To: Albrecht Dreß <albrecht.dress@netcologne.de>; pgsql-general@lists.postgresql.org

On Wed, 2021-03-24 at 09:01 +0100, Albrecht Dreß wrote:
> in the logs of my database server, I found the following message:
> 
> > ERROR: could not attach to dynamic shared area
> > LOG: background worker "parallel worker" (PID 51151) exited with exit code 1

Is that repeatable?

If yes, it would be a bug.

If not, it could be a race condition: a parallel query finished rather fast,
but one of the parallel workers took long to start up, so when it tries to
attach to the dynamic shared memory segment used to exchange data between the
parallel processes, it realizes that everybody else has already left and
destroyed the memory segment.

In the latter case, you can ignore the error.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com






^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: ERROR: could not attach to dynamic shared area
@ 2021-03-24 16:12  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Laurenz Albe <laurenz.albe@cybertec.at>
  1 sibling, 0 replies; 6+ messages in thread

From: Tom Lane @ 2021-03-24 16:12 UTC (permalink / raw)
  To: Laurenz Albe <laurenz.albe@cybertec.at>; +Cc: Albrecht Dreß <albrecht.dress@netcologne.de>; pgsql-general@lists.postgresql.org

Laurenz Albe <laurenz.albe@cybertec.at> writes:
> On Wed, 2021-03-24 at 09:01 +0100, Albrecht Dreß wrote:
>> in the logs of my database server, I found the following message:
>>> ERROR: could not attach to dynamic shared area
>>> LOG: background worker "parallel worker" (PID 51151) exited with exit code 1

> ... it could be a race condition: a parallel query finished rather fast,
> but one of the parallel workers took long to start up, so when it tries to
> attach to the dynamic shared memory segment used to exchange data between the
> parallel processes, it realizes that everybody else has already left and
> destroyed the memory segment.

If the error only appeared in the log, and wasn't reported to the
client, then this theory seems pretty plausible.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: ERROR: could not attach to dynamic shared area
@ 2021-03-24 17:29  Albrecht Dreß <albrecht.dress@netcologne.de>
  parent: Laurenz Albe <laurenz.albe@cybertec.at>
  1 sibling, 0 replies; 6+ messages in thread

From: Albrecht Dreß @ 2021-03-24 17:29 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

Am 24.03.21 17:09 schrieb(en) Laurenz Albe:
> > > ERROR: could not attach to dynamic shared area
> > > LOG: background worker "parallel worker" (PID 51151) exited with exit code 1
> ​
> Is that repeatable?

No, it isn't.  I'm running PGSql 13 since ~4 Months (cluster upgraded from v. 10), and updated to 13.2 ~four weeks ago.  The error occurred exactly /once/.

> If not, it could be a race condition: a parallel query finished rather fast,
> but one of the parallel workers took long to start up, so when it tries to
> attach to the dynamic shared memory segment used to exchange data between the
> parallel processes, it realizes that everybody else has already left and
> destroyed the memory segment.

That makes sense!  The triggering statement I found in the log performs a quite complex join, typically returning very few records.  And the calling application (using libpq) did *not* receive any error.

> In the latter case, you can ignore the error.

Good to know that!

Thanks a lot for your fast help,
Albrecht.

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* ERROR: could not attach to dynamic shared area
@ 2024-06-26 14:43  Andrew Longwill <andrew@busuu.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Andrew Longwill @ 2024-06-26 14:43 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

Hi all,

We’re using Postgresql 15.4 in AWS RDS. Since yesterday we have seen two occurrences where our PHP application becomes unable to connect to our RDS replicas. In the application logs we see the error "FATAL: could not attach to dynamic shared area". The RDS replica remains unusable in this state unless it’s rebooted.

In the Postgresql replica logs we see the following errors just before the above error occurs: (I’ve made the SELECT more succinct)

2024-06-25 21:04:36 UTC::@:[28757]:FATAL: terminating background worker "parallel worker" due to administrator command
2024-06-25 21:04:36 UTC::@:[28757]:STATEMENT: SELECT col1,..,col24 FROM my_table WHERE … DESC LIMIT 1
2024-06-25 21:04:36 UTC::@:[28758]:FATAL: terminating background worker "parallel worker" due to administrator command
2024-06-25 21:04:36 UTC::@:[28758]:STATEMENT: SELECT col1,..,col24 FROM my_table WHERE … DESC LIMIT 1
2024-06-25 21:04:36 UTC::@:[389]:LOG: background worker "parallel worker" (PID 28757) exited with exit code 1
2024-06-25 21:04:36 UTC::@:[389]:LOG: background worker "parallel worker" (PID 28758) exited with exit code 1

The same query is mentioned each time, however this is a query we’ve been running in production for many years. The query plan for that query is good.

AWS have advised that we try setting max_parallel_workers=0 and max_parallel_workers_per_gather=0.

Can anyone advise on why we might be seeing this error suddenly?

Many thanks

Andrew

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: ERROR: could not attach to dynamic shared area
@ 2024-06-27 03:51  Michael Paquier <michael@paquier.xyz>
  parent: Andrew Longwill <andrew@busuu.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2024-06-27 03:51 UTC (permalink / raw)
  To: Andrew Longwill <andrew@busuu.com>; +Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

On Wed, Jun 26, 2024 at 02:43:30PM +0000, Andrew Longwill wrote:
> We’re using Postgresql 15.4 in AWS RDS. Since yesterday we have seen
> two occurrences where our PHP application becomes unable to connect
> to our RDS replicas. In the application logs we see the error
> "FATAL: could not attach to dynamic shared area". The RDS replica
> remains unusable in this state unless it’s rebooted.

I suspect that you have been hit with this issue:
https://www.postgresql.org/message-id/CAO6_XqqJbJBL=M7Ym13TcB4Xnq58vRa2jcC+gwEPBgbAda6B1Q@mail.gmail...

A fix has been committed for it today by me down to v15.  This will
show up in the next round of minor releases.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2024-06-27 03:51 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-03-24 08:01 ERROR: could not attach to dynamic shared area Albrecht Dreß <albrecht.dress@netcologne.de>
2021-03-24 16:09 ` Laurenz Albe <laurenz.albe@cybertec.at>
2021-03-24 16:12   ` Tom Lane <tgl@sss.pgh.pa.us>
2021-03-24 17:29   ` Albrecht Dreß <albrecht.dress@netcologne.de>
2024-06-26 14:43 ERROR: could not attach to dynamic shared area Andrew Longwill <andrew@busuu.com>
2024-06-27 03:51 ` Michael Paquier <michael@paquier.xyz>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox