From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | Dmitry Vasilyev <d(dot)vasilyev(at)postgrespro(dot)ru>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | 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: | 2015-10-16 18:37:36 |
Message-ID: | CA+TgmoZiYV=fFnWQZbfjZ250=YYxAWn_XETGVdUpwFnKxd7B9A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Oct 15, 2015 at 11:32 PM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> Another some what related point is currently we are using random()
> function to ensure a unique name for dsm and it seems to me that
> it is always going to generate same number on first invocation (at least
> thats what happening on windows) due to which you are seeing the
> error. Another options could be to append current pid or data directory
> path as we are doing in win32_shmem.c. I think this could be an
> optimization which can be done in addition to the fix attached (we can
> do this as a separate patch as well, if we agreed to do anything).
Maybe we need to be using PostmasterRandom() rather than random() for
the control segment name.
But regardless, this patch isn't the right fix.
dsm_impl_op(DSM_OP_CREATE, ...) is supposed to return false in the
event of a segment-already-exists condition, without ereporting. If
it hits any OTHER error, then it should ereport(). In the Windows
implementation, the code that caters to this is here:
if (errno == EEXIST)
{
/*
* On Windows, when the segment already exists, a handle for the
* existing segment is returned. We must close it before
* returning. We don't do _dosmaperr here, so errno won't be
* modified.
*/
CloseHandle(hmap);
return false;
}
Kyotaro Horiguchi's analysis seems to me to be going in about the
right direction.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2015-10-16 18:52:08 | checkpoint_segments upgrade recommendation? |
Previous Message | Robert Haas | 2015-10-16 18:21:18 | Re: Obsolete use of volatile in walsender.c, walreceiver.c, walreceiverfuncs.c? |