Re: Unexpected "shared memory block is still in use"

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: noah(at)leadboat(dot)com
Cc: tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Unexpected "shared memory block is still in use"
Date: 2019-05-09 06:28:36
Message-ID: 20190509.152836.153942217.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At Wed, 8 May 2019 22:54:14 -0700, Noah Misch <noah(at)leadboat(dot)com> wrote in <20190509055414(dot)GB1066859(at)rfd(dot)leadboat(dot)com>
> On Wed, May 08, 2019 at 02:32:46PM -0400, Tom Lane wrote:
> > Just now, while running a parallel check-world on HEAD according to the
> > same script I've been using for quite some time, one of the TAP tests
> > died during initdb:
> >
> > selecting dynamic shared memory implementation ... posix
> > selecting default max_connections ... 100
> > selecting default shared_buffers ... 128MB
> > selecting default timezone ... America/New_York
> > creating configuration files ... ok
> > running bootstrap script ... ok
> > performing post-bootstrap initialization ... 2019-05-08 13:59:19.963 EDT [18351] FATAL: pre-existing shared memory block (key 5440004, ID 1734475802) is still in use
> > 2019-05-08 13:59:19.963 EDT [18351] HINT: Terminate any old server processes associated with data directory "/home/postgres/pgsql/src/test/subscription/tmp_check/t_004_sync_publisher_data/pgdata".
> > child process exited with exit code 1
> > initdb: removing data directory "/home/postgres/pgsql/src/test/subscription/tmp_check/t_004_sync_publisher_data/pgdata"
> > Bail out! system initdb failed
> >
> > I have never seen this happen before in the TAP tests.
> >
> > I think the odds are very high that this implies something wrong with
> > commit c09850992.
>
> The odds are very high that you would not have gotten that error before that
> commit. But if the cause matches your guess, it's not something wrong with
> the commit ...
>
> > My immediate guess after eyeballing that patch quickly is that it was
> > not a good idea to redefine the rules used by bootstrap/standalone
> > backends. In particular, it seems somewhat plausible that the bootstrap
> > process hadn't yet completely died when the standalone backend for the
> > post-bootstrap phase came along and decided there was a conflict (which
> > it never would have before).
>
> If so, I would sure try to fix the initdb sequence to not let that happen. I
> would not trust such a conflict to be harmless.
>
> What OS, OS version, and filesystem?

PGSharedMemoryCreate shows the error in SHMSTATE_ANALYSYS_FAILURE
case. PGSharedMemoryAttach returns the code when, for example,
shmat failed with ENOMEM. I'm afraid that the message is not
shown from SHMSTATE_ATTACHED..

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2019-05-09 06:34:16 Re: POC: Cleaning up orphaned files using undo logs
Previous Message Julien Rouhaud 2019-05-09 06:19:44 Re: Wrong return code in vacuumdb when multiple jobs are used