Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uT5UT-00HGAq-8x for pgsql-general@arkaria.postgresql.org; Sat, 21 Jun 2025 21:11:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uT5TR-009Hdy-Re for pgsql-general@arkaria.postgresql.org; Sat, 21 Jun 2025 21:10:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uT5TR-009Hdo-FY for pgsql-general@lists.postgresql.org; Sat, 21 Jun 2025 21:10:06 +0000 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uT5TP-003MyT-2X for pgsql-general@lists.postgresql.org; Sat, 21 Jun 2025 21:10:05 +0000 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-23496600df1so6312045ad.2 for ; Sat, 21 Jun 2025 14:10:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750540201; x=1751145001; darn=lists.postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=H/1VvoxUHRCxp0iI2akSFwfzWRIOnNnZ+wtrud1CHX4=; b=JPkLhyG9Upa1Vc5XFce6+DEIm+APukE1lmRTSn/bN+K/w7G3WLQVjnTDIkQZWIrvOW Uf4oyrvWp1y9WAegLcdY7goBO958UiX636GWDH89hK3XI0Kf+ZbhIJ6wzMbxExEQWksj k7iHjldDqUGh/DwOuPmrYffXF6OyhIPSkrDuQIzZVtWNf40z2wmokaJLidpawCjKtFf8 cqXPw78fRUAd3HlghKy5ESC2JQOuypwPg0JcI+osQIQLg0PDPmK+AnxxTLscNckp0yrT ar73e4CuR7/vzMuncUPYeJyJJigdLLY4go5jJhFnV/uCvA0iRJ6jfle6hhEzpp6DJPN8 s1eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750540201; x=1751145001; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=H/1VvoxUHRCxp0iI2akSFwfzWRIOnNnZ+wtrud1CHX4=; b=bHvy4xcjCtTnQUKfMqXuXZ938DeSEPsAr739RRpPZjxFrIy8iiwOvTG7kLNsqK9V+q +ZGs3Og4EMa5Jit27IqrpqfhJODEbgXXpuww95COFVlNFhLjRbSqzijvJ+IrFp2tNPTG ddxTNkxwT8NuMj1ixsXHs+ka69ftqH9OmJkXg7GYrvGQqCROSbKwf7svP4rWQOLD+Q0k nMzaH1A9WQ+p0fePQJ9HdU9zjcT07QRbf2FqPGXXphYkzMAYFTK/lD5opwSd0U2LebiV 06QJlK45hAAYEwSIglOLdbnHFU8KVqHizKuZLz3/9JSz8qLlNP+S5CAjYI/ves+HDjXq rZpA== X-Gm-Message-State: AOJu0YxoVbXjEL63VDAcx3fMllsasLKoPLCimlqHd1q79+M3cRenVg6u aGvVWkdJeiRCMm92ge9a86rM2JMlY4qHJ7ENjPL+Zy6pjwSVv0c7a2SSI/k0dp1NX9bUyOnwfNc gLoBVpwQFYKzZxYA4OXqSVL+wPBFSRz7AKb1h X-Gm-Gg: ASbGncvJVQF9Pfy0lKwr8kYAgRJ45kMGw5i2ku3FctoM72m/Dl/JkmRGkYXX4u+n/YJ lGx3Q/XsemHqZhR0MbeSRtjbw46M6Zijbra4RiDivhAGGBqsCVzOs+5vUupNkm1wxJatSV9Dyr3 XW6R9N9dmZxoMqdtfjr24U+UhguB+MH8+NNdPZBNfBVM8= X-Google-Smtp-Source: AGHT+IG4xXcN49E6hOAySt8ERftftBtfHiuW4fOxG5KsvijTTEbh2uRd5rBhhxTt880UYH4TISQcNNJELgeiCB+7wBA= X-Received: by 2002:a17:90b:1cc3:b0:312:25dd:1c8a with SMTP id 98e67ed59e1d1-3159d62a650mr4389422a91.2.1750540201315; Sat, 21 Jun 2025 14:10:01 -0700 (PDT) MIME-Version: 1.0 From: =?UTF-8?B?QWxlxaEgWmVsZW7DvQ==?= Date: Sat, 21 Jun 2025 23:09:49 +0200 X-Gm-Features: AX0GCFvoTAedirGHabnEe1XeQ2WkaSWC4OljrWqUSa2zxviyQFrZcE2v6SwY-eY Message-ID: Subject: PostgreSQL 17.5 - could not map dynamic shared memory segment To: "pgsql-generallists.postgresql.org" Content-Type: multipart/alternative; boundary="000000000000dd526d06381b669d" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000dd526d06381b669d Content-Type: text/plain; charset="UTF-8" Hello, After upgrading from (old good no longer supported Pg11) to PostgreSQL 17.5 via pg_dump & pg_restore vacuum started reporting errors: ERROR: could not map dynamic shared memory segment Vacuumdb was invoked: /usr/lib/postgresql/17/bin/vacuumdb -p 5433 -Fvaz -j 12 -v The vacuum finished exit code was 0, but in PostgreSQL instance log files, the errors above were logged. Example error messages from the PostgreSQL log file: 2025-06-21 16:29:56.095 UTC [306130] ERROR: could not map dynamic shared memory segment 2025-06-21 16:29:56.095 UTC [306131] ERROR: could not map dynamic shared memory segment 2025-06-21 16:29:56.097 UTC [135978] LOG: background worker "parallel worker" (PID 306130) exited with exit code 1 2025-06-21 16:29:56.097 UTC [135978] LOG: background worker "parallel worker" (PID 306131) exited with exit code 1 2025-06-21 16:30:23.677 UTC [300930] postgres@fin LOG: could not send data to client: Broken pipe 2025-06-21 16:30:23.677 UTC [300930] postgres@fin CONTEXT: while scanning relation "core.cusip" 2025-06-21 16:30:23.677 UTC [300930] postgres@fin STATEMENT: VACUUM (SKIP_DATABASE_STATS, FREEZE, VERBOSE) core.cusip; 2025-06-21 16:30:23.677 UTC [300930] postgres@fin FATAL: connection to client lost 2025-06-21 16:30:23.677 UTC [300930] postgres@fin CONTEXT: while scanning relation "core.cusip" 2025-06-21 16:30:23.677 UTC [300930] postgres@fin STATEMENT: VACUUM (SKIP_DATABASE_STATS, FREEZE, VERBOSE) core.cusip; 2025-06-21 16:30:23.678 UTC [306190] ERROR: could not map dynamic shared memory segment 2025-06-21 16:30:23.680 UTC [135978] LOG: background worker "parallel worker" (PID 306190) exited with exit code 1 PostgreSQL version: psql -d postgres -c "select version();" version ----------------------------------------------------------------------------------------------------------------------------------- PostgreSQL 17.5 (Ubuntu 17.5-1.pgdg22.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, 64-bit (1 row) Configuration parameters: listen_addresses = '*' # what IP address(es) to listen on; port = 5432 # (change requires restart) max_connections = 400 # (change requires restart) unix_socket_directories = '/var/run/postgresql' # comma-separated list of directories tcp_keepalives_idle = 60 # TCP_KEEPIDLE, in seconds; tcp_keepalives_interval = 5 # TCP_KEEPINTVL, in seconds; tcp_keepalives_count = 3 # TCP_KEEPCNT; tcp_user_timeout = 75s # TCP_USER_TIMEOUT, in milliseconds; client_connection_check_interval = 75s # time between checks for client shared_buffers = 22GB # min 128kB huge_pages = on # on, off, or try temp_buffers = 32MB # min 800kB work_mem = 64MB # min 64kB maintenance_work_mem = 2GB # min 64kB dynamic_shared_memory_type = posix # the default is usually the first option bgwriter_delay = 10ms # 10-10000ms between rounds bgwriter_lru_maxpages = 1000 # max buffers written/round, 0 disables bgwriter_lru_multiplier = 10.0 # 0-10.0 multiplier on buffers scanned/round max_worker_processes = 24 # (change requires restart) wal_level = logical # minimal, replica, or logical wal_log_hints = on # also do full page writes of non-critical updates checkpoint_timeout = 30min # range 30s-1d checkpoint_completion_target = 0.8 # checkpoint target duration, 0.0 - 1.0 max_wal_size = 120GB min_wal_size = 10GB archive_timeout = 1800 # force a WAL file switch after this max_wal_senders = 12 # max number of walsender processes max_replication_slots = 12 # max number of replication slots wal_sender_timeout = 600s # in milliseconds; 0 disables track_commit_timestamp = on # collect timestamp of transaction commit wal_receiver_timeout = 600s # time that receiver waits for jit = off # allow JIT compilation log_min_duration_statement = 1000 # -1 is disabled, 0 logs all statements log_autovacuum_min_duration = 0 # log autovacuum activity; log_checkpoints = on track_activity_query_size = 32768 # (change requires restart) track_io_timing = on track_functions = all # none, pl, all idle_in_transaction_session_timeout = 1200000 # in milliseconds, 0 is disabled shared_preload_libraries = 'pg_stat_statements,pg_stat_kcache,pg_qualstats,pg_partman_bgw,pg_cron,pg_prewarm' # (change requires restart) max_locks_per_transaction = 128 # min 10 OS: Ubuntu 22.04.5 LTS, 16vCPUs, ~123 GB RAM PostgreSQL apt package: postgresql-17/jammy-pgdg,now 17.5-1.pgdg22.04+1 amd64 [installed] Memory: grep -e Mem -e Huge /proc/meminfo MemTotal: 129804320 kB MemFree: 2127576 kB MemAvailable: 100695068 kB AnonHugePages: 0 kB ShmemHugePages: 0 kB FileHugePages: 0 kB HugePages_Total: 12672 HugePages_Free: 10908 HugePages_Rsvd: 9818 HugePages_Surp: 0 Hugepagesize: 2048 kB Hugetlb: 25952256 kB It also happened during the application load test, but I've accidentally copied a wrong log file, and now the server is decommissioned, so I have no details on application queries reporting the exact same message, but it seemed to be related to parallel queries as well if I remember it properly. The application benefits from parallel queries, so despite the first temptation to disable parallel queries (based on log entries correlation only, but is that the root cause?) I did not want to disable parallel queries, if there is another workaround/solution/fix available. Thanks for any hints on how to provide more information if needed, as well as for fix/workaround advice. Kind regards Ales Zeleny --000000000000dd526d06381b669d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,

After upgrading from = (old good no longer supported Pg11) to PostgreSQL 17.5 via pg_dump & pg= _restore vacuum started reporting errors:

ERROR: = =C2=A0could not map dynamic shared memory segment

= Vacuumdb was invoked:

/usr/lib/postgresql/17/bin/v= acuumdb -p 5433 -Fvaz -j 12 -v

The vacuum finished= exit code was 0, but in PostgreSQL instance log files, the errors above we= re logged.

Example error messages from the Postgre= SQL log file:
2025-06-21 16:29:56.095 UTC [306130] ERROR: =C2=A0c= ould not map dynamic shared memory segment
2025-06-21 16:29:56.095 UTC [= 306131] ERROR: =C2=A0could not map dynamic shared memory segment
2025-06= -21 16:29:56.097 UTC [135978] LOG: =C2=A0background worker "parallel w= orker" (PID 306130) exited with exit code 1
2025-06-21 16:29:56.097= UTC [135978] LOG: =C2=A0background worker "parallel worker" (PID= 306131) exited with exit code 1
2025-06-21 16:30:23.677 UTC [300930] po= stgres@fin LOG: =C2=A0could not send data to client: Broken pipe
2025-06= -21 16:30:23.677 UTC [300930] postgres@fin CONTEXT: =C2=A0while scanning re= lation "core.cusip"
2025-06-21 16:30:23.677 UTC [300930] postg= res@fin STATEMENT: =C2=A0VACUUM (SKIP_DATABASE_STATS, FREEZE, VERBOSE) core= .cusip;
2025-06-21 16:30:23.677 UTC [300930] postgres@fin FATAL: =C2=A0c= onnection to client lost
2025-06-21 16:30:23.677 UTC [300930] postgres@f= in CONTEXT: =C2=A0while scanning relation "core.cusip"
2025-06= -21 16:30:23.677 UTC [300930] postgres@fin STATEMENT: =C2=A0VACUUM (SKIP_DA= TABASE_STATS, FREEZE, VERBOSE) core.cusip;
2025-06-21 16:30:23.678 UTC [= 306190] ERROR: =C2=A0could not map dynamic shared memory segment
2025-06= -21 16:30:23.680 UTC [135978] LOG: =C2=A0background worker "parallel w= orker" (PID 306190) exited with exit code 1

P= ostgreSQL version:
psql -d postgres -c "select version();&qu= ot;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 version =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0
-----------------------------------------------------------------= ------------------------------------------------------------------
=C2= =A0PostgreSQL 17.5 (Ubuntu 17.5-1.pgdg22.04+1) on x86_64-pc-linux-gnu, comp= iled by gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, 64-bit
(1 row)
<= div>
Configuration parameters:
listen_addresses =3D= '*' # what IP address(es) to listen on;
port =3D 5432 # (ch= ange requires restart)
max_connections =3D 400 # (change requires rest= art)
unix_socket_directories =3D '/var/run/postgresql' # comma-s= eparated list of directories
tcp_keepalives_idle =3D 60 # TCP_KEEPIDLE,= in seconds;
tcp_keepalives_interval =3D 5 # TCP_KEEPINTVL, in seconds;=
tcp_keepalives_count =3D 3 # TCP_KEEPCNT;
tcp_user_timeout =3D 75s = # TCP_USER_TIMEOUT, in milliseconds;
client_connection_check_interval = =3D 75s # time between checks for client
shared_buffers =3D 22GB # min= 128kB
huge_pages =3D on # on, off, or try
temp_buffers =3D 32MB = # min 800kB
work_mem =3D 64MB # min 64kB
maintenance_work_mem =3D = 2GB # min 64kB
dynamic_shared_memory_type =3D posix # the default is us= ually the first option
bgwriter_delay =3D 10ms # 10-10000ms between ro= unds
bgwriter_lru_maxpages =3D 1000 # max buffers written/round, 0 disa= bles
bgwriter_lru_multiplier =3D 10.0 # 0-10.0 multiplier on buffers sc= anned/round
max_worker_processes =3D 24 # (change requires restart)
= wal_level =3D logical # minimal, replica, or logical
wal_log_hints =3D= on # also do full page writes of non-critical updates
checkpoint_time= out =3D 30min # range 30s-1d
checkpoint_completion_target =3D 0.8 # che= ckpoint target duration, 0.0 - 1.0
max_wal_size =3D 120GB
min_wal_siz= e =3D 10GB
archive_timeout =3D 1800 # force a WAL file switch after thi= s
max_wal_senders =3D 12 # max number of walsender processes
max_rep= lication_slots =3D 12 # max number of replication slots
wal_sender_timeo= ut =3D 600s # in milliseconds; 0 disables
track_commit_timestamp =3D on = # collect timestamp of transaction commit
wal_receiver_timeout =3D 600s = # time that receiver waits for
jit =3D off # allow JIT compilationlog_min_duration_statement =3D 1000 # -1 is disabled, 0 logs all statemen= ts
log_autovacuum_min_duration =3D 0 # log autovacuum activity;
log_c= heckpoints =3D on
track_activity_query_size =3D 32768 # (change requires= restart)
track_io_timing =3D on
track_functions =3D all # none, pl= , all
idle_in_transaction_session_timeout =3D 1200000 # in milliseconds,= 0 is disabled
shared_preload_libraries =3D 'pg_stat_statements,pg_s= tat_kcache,pg_qualstats,pg_partman_bgw,pg_cron,pg_prewarm' # (change r= equires restart)
max_locks_per_transaction =3D 128 # min 10
<= br>

OS:=C2=A0Ubuntu 22.04.5 LTS, 16vCPUs, ~12= 3 GB RAM
PostgreSQL apt package:=C2=A0postgresql-17/ja= mmy-pgdg,now 17.5-1.pgdg22.04+1 amd64 [installed]

Memory:
grep -e Mem -e Huge /proc/meminfo
Me= mTotal: =C2=A0 =C2=A0 =C2=A0 129804320 kB
MemFree: =C2=A0 =C2=A0 =C2=A0 = =C2=A0 2127576 kB
MemAvailable: =C2=A0 100695068 kB
AnonHugePages: = =C2=A0 =C2=A0 =C2=A0 =C2=A0 0 kB
ShmemHugePages: =C2=A0 =C2=A0 =C2=A0 = =C2=A00 kB
FileHugePages: =C2=A0 =C2=A0 =C2=A0 =C2=A0 0 kB
HugePages_= Total: =C2=A0 12672
HugePages_Free: =C2=A0 =C2=A010908
HugePages_Rsvd= : =C2=A0 =C2=A0 9818
HugePages_Surp: =C2=A0 =C2=A0 =C2=A0 =C2=A00
Hug= epagesize: =C2=A0 =C2=A0 =C2=A0 2048 kB
Hugetlb: =C2=A0 =C2=A0 =C2=A0 = =C2=A025952256 kB

It also happened during the appl= ication load test, but I've accidentally copied a wrong log file, and n= ow the server is decommissioned, so I have no details on application querie= s reporting the exact same message, but it seemed to be related to parallel= queries as well if I remember it properly.

The ap= plication benefits from parallel queries, so despite the first temptation t= o disable parallel queries (based on log entries correlation only, but is t= hat the root cause?) I did not want to disable parallel queries, if there i= s another workaround/solution/fix available.

Thank= s for any hints on how to provide more information if needed, as well as fo= r fix/workaround advice.

Kind regards Ales Zeleny<= /div>

--000000000000dd526d06381b669d--