Thread: BUG #17641: postgresql service persistently restarts because "could not open shared memory segment"

The following bug has been logged on the website:

Bug reference:      17641
Logged by:          Jürgen Falch
Email address:      j.falch.16@gmail.com
PostgreSQL version: 15.0
Operating system:   Windows 10 21H2 (19044.2130)
Description:

directly after service startup, postgresql service bails with following
messages (bottom) and restarts.

2022-10-15 20:00:37.750 CEST [19124] LOG:  PostgreSQL 15.0, compiled by
Visual C++ build 1914, 64-bit startet
2022-10-15 20:00:37.754 CEST [19124] LOG:  erwarte Verbindungen auf
IPv6-Adresse »::1«, Port 5432
2022-10-15 20:00:37.754 CEST [19124] LOG:  erwarte Verbindungen auf
IPv4-Adresse »127.0.0.1«, Port 5432
2022-10-15 20:00:37.799 CEST [23992] LOG:  Datenbanksystem wurde
unterbrochen; letzte bekannte Aktion am 2022-10-15 19:58:22 CEST
2022-10-15 20:00:37.925 CEST [23992] LOG:  Datenbanksystem wurde nicht
richtig heruntergefahren; automatische Wiederherstellung läuft
2022-10-15 20:00:37.930 CEST [23992] LOG:  ungültige Datensatzlänge bei
0/14FE398: 24 erwartet, 0 erhalten
2022-10-15 20:00:37.930 CEST [23992] LOG:  Redo nicht nötig
2022-10-15 20:00:37.937 CEST [23816] LOG:  Checkpoint beginnt:
end-of-recovery immediate wait
2022-10-15 20:00:37.948 CEST [23816] LOG:  Checkpoint komplett: 3 Puffer
geschrieben (0.0%); 0 WAL-Datei(en) hinzugefügt, 0 entfernt, 0
wiederverwendet; Schreiben=0,001 s, Sync=0,003 s, gesamt=0,017 s; sync.
Dateien=2, längste=0,003 s, Durchschnitt=0.002 s; Entfernung=0 kB,
Schätzung=0 kB
2022-10-15 20:00:37.973 CEST [19124] LOG:  Datenbanksystem ist bereit, um
Verbindungen anzunehmen
2022-10-15 20:00:44.113 CEST [23816] FATAL:  konnte Shared-Memory-Segment
»Global/PostgreSQL.1886284784« nicht öffnen: No such file or directory
2022-10-15 20:00:44.113 CEST [23816] FATAL:  can't attach the same segment
more than once

this restart is repeated about every three minutes. It is not possible to
attach a client (eg pgAdmin) - fails with "connection refused".


On Sun, Oct 16, 2022 at 8:52 AM PG Bug reporting form
<noreply@postgresql.org> wrote:
> 2022-10-15 20:00:37.973 CEST [19124] LOG:  Datenbanksystem ist bereit, um
> Verbindungen anzunehmen
> 2022-10-15 20:00:44.113 CEST [23816] FATAL:  konnte Shared-Memory-Segment
> »Global/PostgreSQL.1886284784« nicht öffnen: No such file or directory
> 2022-10-15 20:00:44.113 CEST [23816] FATAL:  can't attach the same segment
> more than once

Hi,

Do you have any extensions installed, and can you share any
non-default settings from postgresql.conf or similar?



On Sun, Oct 16, 2022 at 4:31 PM Thomas Munro <thomas.munro@gmail.com> wrote:
> On Sun, Oct 16, 2022 at 8:52 AM PG Bug reporting form
> <noreply@postgresql.org> wrote:
> > 2022-10-15 20:00:37.973 CEST [19124] LOG:  Datenbanksystem ist bereit, um
> > Verbindungen anzunehmen
> > 2022-10-15 20:00:44.113 CEST [23816] FATAL:  konnte Shared-Memory-Segment
> > »Global/PostgreSQL.1886284784« nicht öffnen: No such file or directory
> > 2022-10-15 20:00:44.113 CEST [23816] FATAL:  can't attach the same segment
> > more than once
>
> Hi,
>
> Do you have any extensions installed, and can you share any
> non-default settings from postgresql.conf or similar?

Off-list reply was that this happened straight away with the
EnterpriseDB installer without changing any settings, using
PGDATA=C:\ProgramData\PostgreSQL\data.  I can't immediately guess how
that first error is caused, but it's also interesting that we
apparently screwed up our internal state afterwards because the second
implies that we tried to attach to something we already knew we were
attached to.  But we haven't had any reports like this from our
Windows-based developers who've been testing the 15 branch for a
while, and we don't see this on the buildfarm or CI, so I think the
first port of call here will be to ping the EDB package team and see
if they can reproduce or understand this?  CCing Sandeep for info.



Hi,

On October 16, 2022 2:05:59 PM PDT, Thomas Munro <thomas.munro@gmail.com> wrote:
>On Sun, Oct 16, 2022 at 4:31 PM Thomas Munro <thomas.munro@gmail.com> wrote:
>> On Sun, Oct 16, 2022 at 8:52 AM PG Bug reporting form
>> <noreply@postgresql.org> wrote:
>> > 2022-10-15 20:00:37.973 CEST [19124] LOG:  Datenbanksystem ist bereit, um
>> > Verbindungen anzunehmen
>> > 2022-10-15 20:00:44.113 CEST [23816] FATAL:  konnte Shared-Memory-Segment
>> > »Global/PostgreSQL.1886284784« nicht öffnen: No such file or directory
>> > 2022-10-15 20:00:44.113 CEST [23816] FATAL:  can't attach the same segment
>> > more than once
>>
>> Hi,
>>
>> Do you have any extensions installed, and can you share any
>> non-default settings from postgresql.conf or similar?
>
>Off-list reply was that this happened straight away with the
>EnterpriseDB installer without changing any settings, using
>PGDATA=C:\ProgramData\PostgreSQL\data.  I can't immediately guess how
>that first error is caused, but it's also interesting that we
>apparently screwed up our internal state afterwards because the second
>implies that we tried to attach to something we already knew we were
>attached to.  But we haven't had any reports like this from our
>Windows-based developers who've been testing the 15 branch for a
>while, and we don't see this on the buildfarm or CI, so I think the
>first port of call here will be to ping the EDB package team and see
>if they can reproduce or understand this?  CCing Sandeep for info.

I wonder if there's antivirus active, and if so, which one?

I suspect the problem with the two FATALs might be due to falling in the middle of attaching to a segment, and then
tryingto attach again during the proc exit processing. 

Andres
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.