Re: [HACKERS] Re: [HACKERS] Re: [HACKERS] Windows service is not starting so there’s message in log: FATAL: "could not create shared memory segment “Global/PostgreSQL.851401618”: Permission denied”

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Dmitry Vasilyev <d(dot)vasilyev(at)postgrespro(dot)ru>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] Re: [HACKERS] Re: [HACKERS] Windows service is not starting so there’s message in log: FATAL: "could not create shared memory segment “Global/PostgreSQL.851401618”: Permission denied”
Date: 2016-05-15 06:34:58
Message-ID: CAA4eK1J8sEcdsGLSQn4TWvyV_c=9-Shpq_c7cA2BP8s0NMS_Kg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, May 14, 2016 at 7:33 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>
> On Tue, Mar 22, 2016 at 12:56 AM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
wrote:
> >> >> Yes, same random number generation is not the problem. In windows
apart
> >> >> from EEXIST error, EACCES also needs to be validated and returned
for
> >> >> new random number generation, instead of throwing an error.
> >> >
> >> > Doing the same handling for EACCES doesn't seem to be sane because if
> >> > EACCES
> >> > came for reason other than duplicate dsm name, then we want to report
> >> > the
> >> > error instead of trying to regenerate the name. I think here fix
should
> >> > be
> >> > to append data_dir path as we do for main shared memory.
> >>
> >> Yes, EACCES may be possible other than duplicate dsm name.
> >
> > So as far as I can see there are two ways to resolve this issue, one is
to
> > retry generation of dsm name if CreateFileMapping returns EACCES and
second
> > is to append data_dir name to dsm name as the same is done for main
shared
> > memory, that will avoid the error to occur. First approach has minor
flaw
> > that if CreateFileMapping returns EACCES due to reason other then
duplicate
> > dsm name which I am not sure is possible to identify, then we should
report
> > error instead try to regenerate the name
> >
> > Robert and or others, can you share your opinion on what is the best
way to
> > proceed for this issue.
>
> I think we should retry on EACCES. Possibly we should do other things
> too, but at least that. It completely misses the point of retrying on
> EEXIST if we don't retry on other error codes that can also be
> generated when the segment already exists.
>

Sounds sensible, but if we want to that route, shall we have some mechanism
such that if retrying it for 10 times (10 is somewhat arbitrary, but we
retry 10 times in PGSharedMemoryCreate, so may be there is some
consistency) doesn't give us unique name and we are getting EACCES error,
then just throw the error instead of more retries. This is to ensure that
if the API is returning EACCES due to reason other than duplicate handle,
then we won't retry indefinitely.

With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2016-05-15 12:02:32 Re: 10.0
Previous Message Michael Paquier 2016-05-15 06:02:15 Re: Losing memory references - SRF + SPI